-
Notifications
You must be signed in to change notification settings - Fork 455
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
module: esnext triggers the module warning diagnostic #748
module: esnext triggers the module warning diagnostic #748
Comments
23.10.1
thanks @mllustosa, this is due to the use of You can put this in your jest config to silent the issue while the fix get ready (this is explained in the documentation): // jest.config.js
{
// ...
globals: {
'ts-jest': {
// ...
diagnostics: {
ignoreCodes: [151001]
}
}
}
} |
You are great, man! thanks for the extremely fast reaction and for linking to the documentation. I've set |
Diagnostics have a category. By default if warnOnly is not set, when diagnostic(s) of kind message or suggestion will be raised, ts-jest will log it but not throw. This also changes the category of the internal TS151000. Closes kulshekhar#748
The module value in tsconfig is like `esnext` and erroneously triggers a diagnostic warning, as shown in this issue: kulshekhar/ts-jest#748
This is happening for me since going through an upgrade. The tests run fine, tsc runs fine, but I get this warning for all of my tests. Disabling the diagnostic as demonstrated in this thread works, but I'm hesitant to disable a warning if there is a reason that warning is happening. Is this something that should still be fixed by |
To save any Angular developers stuck with this issue, if you are using jest-preset-angular, remember to read this section in the readme about having a custom ts-config globals setup. I hope this can save you some time debugging failing tests 🤓 |
Install ts-jest to support Jest tests that use and import TypeScript. Pin to ts-jest 23.10.0 to avoid kulshekhar/ts-jest#748.
just set properly tsconfig.ts
|
Make sure your // config/jest.config.js (same folder as config/tsconfig.json)
...
module.exports = {
rootDir: "../",
preset: "ts-jest",
globals: {
"ts-jest": {
compiler: "typescript",
tsConfig: "config/tsconfig.json", // ← important !!!
babelConfig: "config/.babelrc.json"
}
},
...
} |
Issue :
Running my tests on version
23.10.1
outputs an error message. Version23.10.0
works properly.Expected behavior :
Tests should run without any issue. Even a project with a single dummy
expect(1 + 1).toBe(2)
doesn't work.Debug log :
log file content
Output :
Minimal repo :
Clone repo bellow and try running
npm test
.https://github.com/mllustosa/ts-jest-issue
The text was updated successfully, but these errors were encountered: