Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/frontend/parallel_ci_sequencer.js')
-rw-r--r--scripts/frontend/parallel_ci_sequencer.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/scripts/frontend/parallel_ci_sequencer.js b/scripts/frontend/parallel_ci_sequencer.js
index d7a674535a6..262e9e2256e 100644
--- a/scripts/frontend/parallel_ci_sequencer.js
+++ b/scripts/frontend/parallel_ci_sequencer.js
@@ -1,5 +1,15 @@
const Sequencer = require('@jest/test-sequencer').default;
+const sortByPath = (test1, test2) => {
+ if (test1.path < test2.path) {
+ return -1;
+ }
+ if (test1.path > test2.path) {
+ return 1;
+ }
+ return 0;
+};
+
class ParallelCISequencer extends Sequencer {
constructor() {
super();
@@ -8,7 +18,7 @@ class ParallelCISequencer extends Sequencer {
}
sort(tests) {
- const sortedTests = this.sortByPath(tests);
+ const sortedTests = [...tests].sort(sortByPath);
const testsForThisRunner = this.distributeAcrossCINodes(sortedTests);
console.log(`CI_NODE_INDEX: ${this.ciNodeIndex}`);
@@ -19,18 +29,6 @@ class ParallelCISequencer extends Sequencer {
return testsForThisRunner;
}
- sortByPath(tests) {
- return tests.sort((test1, test2) => {
- if (test1.path < test2.path) {
- return -1;
- }
- if (test1.path > test2.path) {
- return 1;
- }
- return 0;
- });
- }
-
distributeAcrossCINodes(tests) {
return tests.filter((test, index) => {
return index % this.ciNodeTotal === this.ciNodeIndex - 1;