Skip to content

Shorter output for reference errors #15767

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshkel
Copy link
Contributor

@joshkel joshkel commented Aug 2, 2025

Because imports are processed asynchronously, an error within one import causes the test runtime to abort and be torn down, which causes the other imports to log numerous redundant errors. Because these errors have no stack traces, they're even more verbose than necessary, with lots of blank lines.

Sample output for one of my projects:
(node:57692) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
FAIL lib packages/lib/src/plots/__tests__/timelineChart.test.ts
  ● Test suite failed to run

    Cannot find module './chartJs/controller.polar.js' from 'src/plots/chartJsInit.ts'

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:863:11)


ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.


Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.45 s
Ran all test suites matching src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.



ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.


To address this, I added logic to suppress redundant errors and to only include stack trace newlines if a stack trace is present.

Sample output after this change:
 FAIL   lib  src/plots/__tests__/timelineChart.test.ts
  ● Test suite failed to run

    Cannot find module './chartJs/controller.polar.js' from 'src/plots/chartJsInit.ts'

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:864:11)

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.514 s

Copy link

netlify bot commented Aug 2, 2025

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7ed2320
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/688e709df091430008b307fd
😎 Deploy Preview https://deploy-preview-15767--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Because imports are processed asynchronously, an error within one import causes the test runtime to abort and be torn down, which causes the other imports to log numerous redundant errors. Because these errors have no stack traces, they're even more verbose than necessary, with lots of blank lines.

Sample output for one of my projects:

```
(node:53121) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
FAIL lib src/plots/__tests__/timelineChart.test.ts
  ● Test suite failed to run

    Cannot find module './chartJs/controller.polar.js' from 'src/plots/chartJsInit.ts'

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:863:11)

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.425 s
Ran all test suites matching src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.

```

To address this, I added logic to suppress redundant errors and to only include stack trace newlines if a stack trace is present.

Sample output after this change:

```
 FAIL   lib  src/plots/__tests__/timelineChart.test.ts
  ● Test suite failed to run

    Cannot find module './chartJs/controller.polar.js' from 'src/plots/chartJsInit.ts'

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:864:11)

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/plots/__tests__/timelineChart.test.ts.
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.514 s
```
@joshkel joshkel force-pushed the shorter-reference-errors branch from e83de25 to 7ed2320 Compare August 2, 2025 20:10
Copy link

pkg-pr-new bot commented Aug 2, 2025

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@15767

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@15767

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@15767

create-jest

npm i https://pkg.pr.new/create-jest@15767

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@15767

expect

npm i https://pkg.pr.new/expect@15767

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@15767

jest

npm i https://pkg.pr.new/jest@15767

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@15767

jest-circus

npm i https://pkg.pr.new/jest-circus@15767

jest-cli

npm i https://pkg.pr.new/jest-cli@15767

jest-config

npm i https://pkg.pr.new/jest-config@15767

@jest/console

npm i https://pkg.pr.new/@jest/console@15767

@jest/core

npm i https://pkg.pr.new/@jest/core@15767

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@15767

jest-diff

npm i https://pkg.pr.new/jest-diff@15767

jest-docblock

npm i https://pkg.pr.new/jest-docblock@15767

jest-each

npm i https://pkg.pr.new/jest-each@15767

@jest/environment

npm i https://pkg.pr.new/@jest/environment@15767

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@15767

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@15767

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@15767

@jest/expect

npm i https://pkg.pr.new/@jest/expect@15767

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@15767

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@15767

@jest/globals

npm i https://pkg.pr.new/@jest/globals@15767

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@15767

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@15767

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@15767

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@15767

jest-message-util

npm i https://pkg.pr.new/jest-message-util@15767

jest-mock

npm i https://pkg.pr.new/jest-mock@15767

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@15767

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@15767

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@15767

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@15767

jest-resolve

npm i https://pkg.pr.new/jest-resolve@15767

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@15767

jest-runner

npm i https://pkg.pr.new/jest-runner@15767

jest-runtime

npm i https://pkg.pr.new/jest-runtime@15767

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@15767

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@15767

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@15767

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@15767

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@15767

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@15767

@jest/transform

npm i https://pkg.pr.new/@jest/transform@15767

@jest/types

npm i https://pkg.pr.new/@jest/types@15767

jest-util

npm i https://pkg.pr.new/jest-util@15767

jest-validate

npm i https://pkg.pr.new/jest-validate@15767

jest-watcher

npm i https://pkg.pr.new/jest-watcher@15767

jest-worker

npm i https://pkg.pr.new/jest-worker@15767

pretty-format

npm i https://pkg.pr.new/pretty-format@15767

commit: 7ed2320

@joshkel
Copy link
Contributor Author

joshkel commented Aug 2, 2025

Jest should perhaps suppress all reference in-teardown errors if it knows an error was thrown. I can look into making that change as well or instead if there's interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant