Repository navigation
fix: jest globalSetup/globalTeardown without a preset, support <rootDir> - #68
Open
exo-nikita wants to merge 2 commits into
Open
exo-nikita wants to merge 2 commits into
exo-nikita wants to merge 2 commits into
Conversation
This branch has not been deployed
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
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.
Fixes two
--jestconfig loading bugs forglobalSetup/globalTeardown.1. Crash on
globalSetup/globalTeardownwithout apresetSince
71c65f3(first released in rc.97),loadJestConfig()enters the preset/globalSetup branch when either is set, but then unconditionally callscleanFile(rawConfig.preset). With no preset, that throws:Consumers currently work around it with
preset: ''in their jest config, which can be dropped after this is released.2.
<rootDir>inglobalSetup/globalTeardownJest supports
globalSetup: '<rootDir>/…', but we passed it torequire.resolve()as is:Top-level
globalSetup/globalTeardownnow get the same<rootDir>/→./treatment aspreset(relative torootDir, top level only, as before).Tests
New
test:global-setupscript (added totest:all, same pattern astest:jsdom): no preset,globalSetupvia<rootDir>/…,globalTeardownvia./…. The test assertsglobalSetupran before tests, and the teardown throws if it ran without setup.mainwith theTypeError, and withCannot find module '<rootDir>/…'with only the first commitCI=1 pnpm test:allandpnpm lintpass locally (Node 24)