ts-jest fails to work with TS 3.7.2
See original GitHub issueIssue :
When I’ve updated my deps, the tests stopped working. I have a custom monorepo setup with TS references, Jest projects and ttypescript
compiler to rewrite @paths
on compile.
FAIL packages/core/tests/functional/bar.ts
● Test suite failed to run
Cannot find module '@typegraphql/core' from 'bar.ts'
> 1 | import { bar } from "@typegraphql/core";
| ^
2 |
3 | describe("bar", () => {
4 | it("should return 'bar'", () => {
at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
When I’ve downgraded the TS deps to 3.6.3, it works as earlier:
PASS tests/functional/bar.ts
PASS tests/functional/foo.ts
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
I’ve created two branches that you can checkout and reproduce: https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.7.2 https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.6.3
Expected behavior :
It should work as before upgrade.
Minimal repo :
https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.7.2 https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.6.3
git clone
npm i (on root folder)
npm run bootstrap
cd packages/core
npx jest --watch
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
Jest errors when trying to run TypeScript Tests - Stack Overflow
When trying to run my tests in a dual client / server repo, I'm getting the following error that I can't seem to...
Read more >ts-jest - npm
ts -jest. A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. NPM version NPM...
Read more >Diagnostics option | ts-jest - GitHub Pages
The diagnostics option configures error reporting. ... If a diagnostic is not filtered out, ts-jest will fail the compilation and your test.
Read more >jest encountered an unexpected token ts-jest - You.com
Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest...
Read more >How to Test TypeScript with Jest - Medium
Install ts-jest and @types/jest into your project by running the following command: ... However, this will not work with TypeScript.
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
Hey @MichalLytek 😃
I’m hitting a similar-seeming issue. In my project I do not have this error in VSCode, just from ts-jest.
But It might not be related as I downgraded to 3.6 and still have this error. My case doesn’t seem to be tied to 3.7.
please do these following steps:
tsconfig.spec.json
which extendstsconfig.json
ts-jest
config to use thattsconfig.spec.json
module: commonjs
andtarget: es2020
(don’t usetarget: esnext
) to thistsconfig.spec.json
.