Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move web and api jest configs to proper directories #256

Closed
wants to merge 1 commit into from

Conversation

AryanJ-NYC
Copy link
Contributor

Contributes to #181

@thedavidprice
Copy link
Contributor

thedavidprice commented Mar 15, 2020

Hi @AryanJ-NYC thanks for getting this process started. I only had time for a quick look but will spend more time early next week.

There is some complexity here because the package/core/ is providing config to the create-redwood-app, and what we think we need to do is make that config extensible in the create-redwood-app root, api, and web directories. (Maybe… that’s the current discussion about what the best path forward is.) So in this case, it’s not adding the config to separate web/ and api/ folders within core/config/, it’s actually about moving them to create-redwood-app/web/…, etc over in https://github.com/redwoodjs/create-redwood-app Developers are going to have all kinds of wacky things to add to jest + babel config and will need to extend as needed. Does that make sense?

Looping in @peterp ‘cause this is good momentum to get us back on the conversation.

@AryanJ-NYC
Copy link
Contributor Author

Hey @thedavidprice. Thanks for the feedback.

What if users are defaulted with no jest.config.js in both the web and api directories BUT can make a jest.config.js that Redwood uses to extend the base jest.config.js in @redwoodjs/web and @redwood/api?

That way, there's zero config unless otherwise needed.

I'm basing this on next.js use of next.config.js: https://nextjs.org/docs/api-reference/next.config.js/introduction. I'm quite sure they simple take in the custom config and extend their own based on the customization.

@thedavidprice
Copy link
Contributor

Yes, that’s the right direction! If you haven’t already, see current conversation with Peter here #181

For now I think we can just leave files as-is in core/config. And then we’ll need to tie together two things:

  • the actual command that’s run when user enters yarn rw test, which is 'yarn jest --passWithNoTests --config ../node_modules/@redwoodjs/core/config/jest.config.[api | web].js' found here: packages/cli/src/commands/test.js
  • a means to extend our core config within the app using something similar to Babel “extends” or the Nextjs example above.

We’ll need documentation either way. I’m in favor of an empty starter/template file already in the app with simple commented help text at the top. But more files in CRA is more overhead to upgrade over time. TBD

@AryanJ-NYC AryanJ-NYC closed this Mar 21, 2020
@AryanJ-NYC AryanJ-NYC deleted the issue#181 branch March 21, 2020 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants