Upgrading from 25.3.1 to 25.4.0 breaks monorepo projects
See original GitHub issue🐛 Bug Report
I have a TypeScript project using Yarn workspaces and TypeScript project references. I have a single shared project used by my backend and frontend projects. As expected, some tests in both backend and frontend projects rely on classes and functions exported from the shared project.
When using 25.3.1 version, I can run the tests without any issues. Shared code is correctly imported.
After updating to 25.4.0 or 25.5.0, I run into the following issue:
FAIL backend <TEST NAME>.test.ts
● Test suite failed to run
File not found: /PATH/TO/PROJECT/packages/shared/dist/index.js (resolved as: /PATH/TO/PROJECT/packages/shared/dist/index.js)
at ConfigSet.resolvePath (../../node_modules/ts-jest/dist/config/config-set.js:697:19)
at Object.getCompileResultFromReferencedProject (../../node_modules/ts-jest/dist/compiler/compiler-utils.js:122:38)
at compileFn (../../node_modules/ts-jest/dist/compiler/language-service.js:126:41)
at Object.compile (../../node_modules/ts-jest/dist/compiler/instance.js:52:21)
at TsJestTransformer.process (../../node_modules/ts-jest/dist/ts-jest-transformer.js:85:41)
at ScriptTransformer.transformSource (../../node_modules/@jest/transform/build/ScriptTransformer.js:481:35)
at ScriptTransformer._transformAndBuildScript (../../node_modules/@jest/transform/build/ScriptTransformer.js:586:40)
at ScriptTransformer.transform (../../node_modules/@jest/transform/build/ScriptTransformer.js:624:25)
It seems that the shared project cannot be correctly resolved.
To Reproduce
Steps to reproduce the behavior:
- Setup a TypeScript Yarn project with workspaces and project references.
- Set one project as a dependency of the other.
- Write a test that references the imported project.
See https://github.com/czyzby/ts-node-1613-reproduction.
Expected behavior
- Tests should pass and dependency project should be correctly resolved.
envinfo
System:
OS: Linux Mint 19.3
Npm packages:
jest: 25.1.0
ts-jest: 25.4.0
typescript: 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:20
Top Results From Across the Web
No results found
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
25.5.1 is out
I can confirm that the fixed version you uploaded passes the CI tests.