-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug] babel-jest throws if only
in babel.config.js excludes current file
#7765
Comments
Thanks for the reproduction! This is a completely separate issue from #7438. This fails due to the babel config having only: [
'src',
'styleguide',
], That makes diff --git i/package.json w/package.json
index da61831a..b03f0ea1 100644
--- i/package.json
+++ w/package.json
@@ -167,6 +167,10 @@
"node_modules",
"src"
],
+ "transformIgnorePatterns": [
+ "/node_modules/",
+ "/internals/"
+ ],
"testRegex": "tests/.*\\.test\\.js$",
"testResultsProcessor": "jest-sonar-reporter"
}, @loganfsmyth does it make sense for |
I think this is a babel bug, no? If no babel config is found, this is the result: PartialConfig {
options:
{ filename: '/Users/simen/repos/ugh/hello.js',
babelrc: false,
configFile: false,
passPerPreset: false,
envName: 'development',
cwd: '/Users/simen/repos/ugh',
root: '/Users/simen/repos/ugh',
plugins: [],
presets: [] },
babelignore: undefined,
babelrc: undefined,
config: undefined } $ cat index.js
const { loadPartialConfig } = require("@babel/core");
const o = loadPartialConfig({ filename: require.resolve("./hello.js") });
console.log(o);
$ cat hello.js
$ node index.js
PartialConfig {
options:
{ filename: '/Users/simen/repos/ugh/hello.js',
babelrc: false,
configFile: false,
passPerPreset: false,
envName: 'development',
cwd: '/Users/simen/repos/ugh',
root: '/Users/simen/repos/ugh',
plugins: [],
presets: [] },
babelignore: undefined,
babelrc: undefined,
config: undefined } |
@SimenB thanks, I have applied the temporary fix by adding into + transformIgnorePatterns: [
+ '/node_modules/'
+ '/internals/'
+ ] Thanks! |
Still a bug, in either Jest or Babel, so I'll reopen this to keep track of it 🙂 |
only
in babel.config.js excludes current file
|
This also fails when the current test file is excluded with |
Yeah, we need to handle Babel saying "nope". I'll put together a PR |
Not sure how to handle code coverage. We currently do that by adding a babel plugin. Should we still do that even though a file is ignored by babel config? |
I think I'll just throw an error saying that you need to also ignore the file in |
@SimenB Yes, a warning like that would have helped me. Thank you for the fast response :) |
PR: #7797 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am upgrading jest 23.6.0 to jest 24.0.0.
They have deprecated
setupTestFrameworkScriptFile
, see: https://jestjs.io/docs/en/configuration#setupfilesafterenv-arrayWe used to have in our
package.json
:We have tried to update to :
We now have the following error in our test
npm run test
:This is how our
test-bundler.js
:It fails when doing:
const babelOptions = loadBabelConfig("/home/dka/workspace/github.com/bootstrap-styled/v4", "/home/dka/workspace/github.com/bootstrap-styled/v4/internals/testing/test-bundler.js");
babelOptions
is nullThis is happening in babel-jest package after upgrading from 23.6.0 to 24.0.0
It seems that
setupFilesAfterEnv
behave differently, does anybody know how to fix it, I see many breaking change on their changlog since our two version but none says how to fix this.reproduction
There's also a detailled issue on stackoverflow
Travis build failure: https://travis-ci.org/bootstrap-styled/v4/jobs/486846842#L614
The text was updated successfully, but these errors were encountered: