next {dev,build} command should ignore __tests__ dir
See original GitHub issueIn jest example, if we move ./__tests__
to ./pages/__tests__
and then run next build
then an error occurs.
The solution is not trying to solve this error, but make next ignore some patterns, fe *.{spec,test}.js
or some dirs like __{mocks,tests}__
Otherwise, those dev files would be available in public dir, WDYT ?
Issues #988 #1545 #1689 talks about the same problem (sadly without any solution).
BTW next.js rocks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to exclude test files in next.js during build? - Stack Overflow
You can have your .spec files in any other folder such as /components but not /pages . As per documentation, for testing pages...
Read more >Testing | Next.js
Learn how to set up Next.js with three commonly used testing tools — Cypress, Playwright, Jest, and React Testing Library.
Read more >How To Set Up Next.JS With Jest, React Testing Library and ...
One last thing to add is that we want to ignore Playwright's tests when we're running our npm run test command. To do...
Read more >Get started with Netlify CLI
Then, run this command from any directory in your terminal: ... With continuous deployment, Netlify will automatically deploy new versions of your site...
Read more >IBM Cloud CLI Developer Tools ( ibmcloud dev ) commands
The test , debug , and run commands expect to find a compiled app so you must run a build ... Usage: ibmcloud...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
agreed with @sboudrias-aa and @ericnograles . @arunoda please reconsider this decision. writing tests next to the module also helps a lot with refactoring because you can delete / move entire directories and still have things work.
Design suggestion: add an
excludeFile
option tonext.config.js
which accepts a function to exclude certain files from being webpack’d.This option would be passed straight to
emit-file-loader
’sexclude
option (and merged with the normalnode_modules
exclude) to prevent it from building it as a page. For example:If that sounds good I can make a PR for this!