Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d2d835e1
Commit
d2d835e1
authored
Feb 13, 2020
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable parallel jest
parent
58b1f41a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
.gitlab/ci/frontend.gitlab-ci.yml
.gitlab/ci/frontend.gitlab-ci.yml
+2
-1
scripts/frontend/parallel_ci_sequencer.js
scripts/frontend/parallel_ci_sequencer.js
+28
-0
No files found.
.gitlab/ci/frontend.gitlab-ci.yml
View file @
d2d835e1
...
...
@@ -207,7 +207,7 @@ karma-as-if-foss:
extends
:
.frontend-job-base
script
:
-
date
-
yarn jest --ci --coverage
-
yarn jest --ci --coverage
--testSequencer ./scripts/frontend/parallel_ci_sequencer.js
cache
:
key
:
jest
paths
:
...
...
@@ -229,6 +229,7 @@ jest:
-
tmp/tests/frontend/
reports
:
junit
:
junit_jest.xml
parallel
:
2
jest-as-if-foss
:
extends
:
...
...
scripts/frontend/parallel_ci_sequencer.js
0 → 100644
View file @
d2d835e1
const
Sequencer
=
require
(
'
@jest/test-sequencer
'
).
default
;
class
ParallelCISequencer
extends
Sequencer
{
constructor
()
{
super
();
this
.
ciNodeIndex
=
parseInt
(
process
.
env
.
CI_NODE_INDEX
||
'
1
'
);
this
.
ciNodeTotal
=
parseInt
(
process
.
env
.
CI_NODE_TOTAL
||
'
1
'
);
}
sort
(
tests
)
{
const
testsForThisRunner
=
this
.
distributeAcrossCINodes
(
tests
);
console
.
log
(
`CI_NODE_INDEX:
${
this
.
ciNodeIndex
}
`
);
console
.
log
(
`CI_NODE_TOTAL:
${
this
.
ciNodeTotal
}
`
);
console
.
log
(
`Total number of tests:
${
tests
.
length
}
`
);
console
.
log
(
`Total number of tests for this runner:
${
testsForThisRunner
.
length
}
`
);
return
super
.
sort
(
testsForThisRunner
);
}
distributeAcrossCINodes
(
tests
)
{
return
tests
.
filter
((
test
,
index
)
=>
{
return
index
%
this
.
ciNodeTotal
===
this
.
ciNodeIndex
-
1
;
});
}
}
module
.
exports
=
ParallelCISequencer
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment