-
-
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
Open
joshkel
wants to merge
1
commit into
jestjs:main
Choose a base branch
from
joshkel:shorter-reference-errors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: