question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:20

github_iconTop GitHub Comments

1reaction
ahnpnlcommented, May 9, 2020

25.5.1 is out

1reaction
czyzbycommented, May 8, 2020

I can confirm that the fixed version you uploaded passes the CI tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found