[Feature]: Lift `moduleFileExtensions` option validation.
See original GitHub issue🚀 Feature Proposal
Do not validate that moduleFileExtensions
must include "js"
. We could change it to not empty or even allow empty array values to result in not finding any test files. Perhaps with a warning, example below.
Motivation
As we are moving towards supporting ESM #9430, users writing test entirely as esModules (or transpiled/formed to) would find it confusing that they must include a "js"
extension.
Example
// jest.config.mjs
export default {
moduleFileExtensions: [
"mjs",
],
testRegex: "test\.mjs",
transform: {},
};
As of v27.4.0 will get this error
● Validation Error:
moduleFileExtensions must include 'js':
but instead received:
["mjs"]
Please change your configuration to include 'js'.
Configuration Documentation:
https://jestjs.io/docs/configuration
The script failed with exit code 1
Pitch
Well, this is clearly a jest validation rule.
The existing no tests found message
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in /path/to/root/test/dir.
Make sure Jest's configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: https://jestjs.io/docs/configuration
Pattern: - 0 matches
The script failed with exit code 1
Particularly, the line
Make sure Jest's configuration does not exclude this directory.
Could be extened to
Make sure Jest's configuration does not exclude this directory and extension of test files.
Or perhaps
Make sure Jest's configuration includes this directory and extension of test files.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
jest-validate | Yarn - Package Manager
Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration.
Read more >babel ignores - make sure to include the file in jest's ... - You.com
Feature Proposal. Do not validate that moduleFileExtensions must include "js" . We could change it to not empty or even allow empty array...
Read more >Configuring Jest
The bail config option can be used here to have Jest stop running tests after ... It must be a node module that...
Read more >LinkedIn Brand Lift Testing Management API - Microsoft Learn
Caller provides this field as -1 when trying to validate the ... The choice of lift test entity determines which campaigns to operate...
Read more >Configuring package.json · Jest
When using the --config option, the JSON file must not contain a "jest" key: ... moduleFileExtensions [array<string>]; moduleDirectories [array<string>] ...
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 FreeTop 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
Top GitHub Comments
I know what you want to say, it’s just my opinion. It’s not like I don’t get what you meant:)
How to mock
fs/promises
with ESM?