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

Support async sort in custom testSequencer. #8642

Merged
merged 4 commits into from Jul 4, 2019

Conversation

scotthovestadt
Copy link
Contributor

Summary

When overriding testSequencer with custom logic, forcing synchronous sorting can be limiting. One use-case is fetching test runtime from an endpoint instead of relying on the local cache; this requires an async roundtrip and is not currently possible.

This extremely simple PR adds the optional ability for sort to return a Promise without requiring it to.

Test plan

  • All existing tests pass.
  • Added e2e test for async use of sort.
  • Tested manually with real-world implementation.

@@ -183,7 +183,7 @@ export default (async function runJest({
}),
);

allTests = sequencer.sort(allTests);
allTests = await sequencer.sort(allTests);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the entire PR, the rest is test and docs.

@scotthovestadt scotthovestadt changed the title Support async sort in testSequencer. Support async sort in custom testSequencer. Jul 4, 2019
@codecov-io
Copy link

codecov-io commented Jul 4, 2019

Codecov Report

Merging #8642 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #8642   +/-   ##
======================================
  Coverage    63.4%   63.4%           
======================================
  Files         274     274           
  Lines       11342   11342           
  Branches     2770    2771    +1     
======================================
  Hits         7191    7191           
  Misses       3534    3534           
  Partials      617     617
Impacted Files Coverage Δ
packages/jest-core/src/runJest.ts 34.66% <100%> (ø) ⬆️

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 2b64bb4...48d973c. Read the comment docs.

@scotthovestadt scotthovestadt merged commit 9c70ba0 into jestjs:master Jul 4, 2019
@scotthovestadt scotthovestadt deleted the async-sequencer branch July 4, 2019 07:50
@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.

None yet

5 participants