Skip to content
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

Add setupFilesAfterEnv; run setupFiles before the env setup #21

Merged
merged 6 commits into from
Apr 26, 2022

Conversation

nicolo-ribaudo
Copy link
Owner

@nicolo-ribaudo nicolo-ribaudo commented Apr 24, 2022

Thanks to #16, I learned that the correct order is

  1. setupFiles
  2. Jest's environment
  3. setupFilesAfterEnv

With this PR, setupFiles is run once per global context.

Fixes #16

cc @fisker The prettier tests still pass, but you might be interested in this.

@nicolo-ribaudo nicolo-ribaudo force-pushed the fix-setupFiles branch 2 times, most recently from f86b4a4 to d681d69 Compare April 24, 2022 20:17
@nicolo-ribaudo nicolo-ribaudo changed the title Run setupFiles before installing Jest's globals Add setupFilesAfterEnv, and run setupFiles before setting up the env Apr 24, 2022
Copy link
Contributor

@fisker fisker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

};
let initialSetupP;
function initialSetup(projectConfig) {
initialSetupP ||= (async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
initialSetupP ||= (async () => {
initialSetupP ??= (async () => {

@nicolo-ribaudo nicolo-ribaudo changed the title Add setupFilesAfterEnv, and run setupFiles before setting up the env Add setupFilesAfterEnv; run setupFiles before the env setup Apr 26, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 4caa3d3 into main Apr 26, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the fix-setupFiles branch April 26, 2022 12:41
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.

Support "setupFilesAfterEnv"
3 participants