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

chore: move execution of setupFiles to jest-runner #9596

Merged
merged 2 commits into from
Feb 19, 2020

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 19, 2020

Summary

Since ESM is asynchronous we cannot run this as part of jest-runtime's constructor.

This is technically a breaking change, but I'd be hugely surprised if someone either uses a custom runtime or uses jest-runtime directly. Can hold off on merging until Jest 26 changes start landing, but that'll make it impossible to land any kind of support for ESM in setupFiles. Maybe not a biggie 🙂

Test plan

Green CI

@@ -163,6 +163,8 @@ async function runTestInternal(

const start = Date.now();

config.setupFiles.forEach(path => runtime!.requireModule(path));
Copy link
Member Author

@SimenB SimenB Feb 19, 2020

Choose a reason for hiding this comment

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

I do this up here since it happened in the constructor previously. However, I wonder if it makes more sense to do it after we call the environment's setup function further down? If not, maybe right before? Seems like they belong together

https://github.com/facebook/jest/blob/9fbe3c5bd07002d569a1b4037d53556244a728cd/packages/jest-runner/src/runTest.ts#L230

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can mark it as a todo for later, to group similar features together. However for now, to avoid unintended breakages, I'd stay with what's closer to previous version

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, makes sense

import setGlobal from './setGlobal';
import deepCyclicCopy from './deepCyclicCopy';
import convertDescriptorToString from './convertDescriptorToString';
export {default as clearLine} from './clearLine';
Copy link
Member Author

@SimenB SimenB Feb 19, 2020

Choose a reason for hiding this comment

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

snuck this in

@codecov-io
Copy link

Codecov Report

Merging #9596 into master will increase coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #9596      +/-   ##
=========================================
+ Coverage   65.08%   65.1%   +0.01%     
=========================================
  Files         286     286              
  Lines       12144   12141       -3     
  Branches     3008    3007       -1     
=========================================
  Hits         7904    7904              
+ Misses       3605    3603       -2     
+ Partials      635     634       -1
Impacted Files Coverage Δ
packages/jest-runtime/src/index.ts 65.75% <ø> (+0.44%) ⬆️
packages/jest-runner/src/runTest.ts 2.17% <0%> (-0.03%) ⬇️
packages/jest-jasmine2/src/index.ts 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fbe3c5...273db2a. Read the comment docs.

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

👍

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants