-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add non optimal parallelization across 6 instances (#815)
* add non optimal parallelization across 6 instances * randomize sequencer with deterministic ordering disable fail-fast to allow more explicit failure reporting * fixed tests sorting code ordering
- Loading branch information
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const Sequencer = require('@jest/test-sequencer').default | ||
const ShuffleSeed = require('shuffle-seed') | ||
|
||
class CustomSequencer extends Sequencer { | ||
sort (tests) { | ||
// In CI, GitHub Actions tests are parallelized across multiple instance | ||
if (process.env.GH_INSTANCE_TOTAL) { | ||
const total = parseInt(process.env.GH_INSTANCE_TOTAL, 10) | ||
const index = parseInt(process.env.GH_INSTANCE_INDEX, 10) | ||
|
||
return ShuffleSeed.shuffle(tests, 'deterministic') | ||
.filter((_, i) => i % total === index) | ||
} | ||
|
||
return tests | ||
} | ||
} | ||
|
||
module.exports = CustomSequencer |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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