Do you want to request a _feature_ or report a _bug_?
_bug_
What is the current behavior?
Jest testmatch filter currently doesn't work (ignores .mjs extension).
my work around is to rename all .mjs to .js and transpile them through babel for testing only 馃槩
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.
yaml
"testMatch": [
'**/spec/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)',
'**/spec/**/*.mjs', '**/?(*.)(spec|test).mjs'
],
What is the expected behavior?
Jest will find the matching .mjs files and either:
execute the import statement natively (pass experimental flag if node version is 8.9.3 above) or,
transpile the .mjs files using babel.
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
version:
Jest: v21.2.1
Node: 8.9.3
Yarn: 1.2.3
"jest": {
"roots": [
"<rootDir>/src/",
"<rootDir>/spec/"
],
"transform": {
"^.+\\.m?jsx?$": "babel-jest"
},
"testMatch": [
'**/spec/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)',
'**/spec/**/*.mjs', '**/?(*.)(spec|test).mjs'
],
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/"
],
"verbose": true
},
duplicate of #4637
Thank you @Haroenv!
duplicate of #4637
No, this issue regards using Jest without Babel. I guess the issue should be reopened.
This issue explicitly sets babel-jest up to transpile mjs, look at the config in the OP.
If you wanna track native mjs support in jest, follow #4842 and #9430.
Most helpful comment
This issue explicitly sets
babel-jestup to transpilemjs, look at the config in the OP.If you wanna track native mjs support in jest, follow #4842 and #9430.