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.

Can't run tests with jest 28.0

See original GitHub issue

Current Behavior

I tried updating jest to the latest version (28) and started experiencing the classic TypeScript errors that you get when there are Babel / compiling TypeScript issues. For example: SyntaxError: Unexpected token 'export' or SyntaxError: Cannot use import statement outside a module I’m using babel-jest as the transform for my TypeScript tests.

Expected Behavior

I should be able to use jest 28 to run my tests.

Steps to Reproduce

Here is a repo reproduction. https://github.com/Tirke/jest-28

If you switch back to jest 27 it will work. They did communicate on some changes with Babel here

Failure Logs

Environment

❯ pnx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.2
   OS   : darwin arm64
   pnpm : 7.0.0

   nx : 14.0.5
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.0.5
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.0.5
   @nrwl/eslint-plugin-nx : 14.0.5
   @nrwl/express : Not Found
   @nrwl/jest : 14.0.5
   @nrwl/js : 14.0.5
   @nrwl/linter : 14.0.5
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.0.5
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : 14.0.5
   @nrwl/workspace : 14.0.5
   typescript : 4.6.4
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:13
  • Comments:28 (16 by maintainers)

github_iconTop GitHub Comments

17reactions
barbados-clemenscommented, Jun 6, 2022

@eglove @rfprod it shouldn’t break anything once the nx migration is ran. the only thing that would get overridden I think would get overridden would be the jest version if they don’t match. Any breaking changes from jest 28 the migration would update would presumably already be fixed in your code base.

I’m going to try to finish the jest 28 migration this week. Just putting the final touches on the Cypress 10 support.

7reactions
barbados-clemenscommented, May 23, 2022

it’s in progress. the migrations are a bit tricky for this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest 28: Shedding weight and improving compatibility
Jest 28 is finally here, and it comes with some long requested features such as support for sharding a test run across multiple...
Read more >
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 >
jest | Yarn - Package Manager
Instant Feedback: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files....
Read more >
cannot find module 'jest-util' | The AI Search Engine You Control
This function is now deprecated and will be removed in 28.0.0. ... But when I run jest test, I got "Cannot find module"...
Read more >
ts-jest - npm
Start using ts-jest in your project by running `npm i ts-jest`. ... support that lets you use Jest to test projects written in...
Read more >

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