-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
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 ```
e83de25
to
7ed2320
Compare
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great, thank you so so much for all your PRs!
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:
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: