- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.6k
fix: prevent double teardown on test environment error #15731
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. | 
| 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:  | 
ba5b2b1    to
    ec50f9c      
    Compare
  
    ec50f9c    to
    cac64d4      
    Compare
  
    | Please note that the test coverage reduction report is erroneous. This case has been covered by E2E test I added. | 
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.
Thank you!
| This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. | 
Summary
This PR fixes a regression where errors thrown from a custom environment’s
teardown()method were masked by an internal error, rather than being reported to the user. This led to confusing error messages and made debugging custom environments difficult.isTornDownis always set in afinallyblock, even ifenvironment.teardown()throws. This prevents double teardown and ensures the real error is surfaced.teardown()Why
The "object" argument must be of type object. Received null) instead of the real cause.Test plan
teardown(), and asserts that the error is reported as expected.