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:
authorLukas Eipert <git@leipert.io>2018-04-10 12:12:24 +0300
committerLukas Eipert <git@leipert.io>2018-04-10 12:12:24 +0300
commit35d754f6e571717523f11f6dcfe4e13ce508adf9 (patch)
tree9b2dd6b2205d220d5e420a3b6f79a5cbdfc4acbd /spec/javascripts/test_bundle.js
parent8e66411488e87d59dde65c690892d9495292fe86 (diff)
read which testfiles to run from CLI
Diffstat (limited to 'spec/javascripts/test_bundle.js')
-rw-r--r--spec/javascripts/test_bundle.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index 72671cbbda7..ec14be73722 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -70,20 +70,22 @@ beforeEach(() => {
});
// eslint-disable-next-line no-undef
-let testFile = TEST_FILE;
-if (testFile) {
- console.log(`Running only ${testFile}`);
- testFile = testFile.replace(/^spec\/javascripts\//, '');
- testFile = testFile.replace(/\.js$/, '');
+let testFile = TEST_FILES;
+if (testFile instanceof Array && testFile.length > 0) {
+ console.log(`Running only tests: ${testFile}`);
+ testFile = testFile.map(path => path.replace(/^spec\/javascripts\//, '').replace(/\.js$/, ''));
+} else {
+ console.log('Running all tests');
+ testFile = [];
}
const axiosDefaultAdapter = getDefaultAdapter();
// render all of our tests
const testsContext = require.context('.', true, /_spec$/);
-testsContext.keys().forEach(function (path) {
+testsContext.keys().forEach(function(path) {
try {
- if (!testFile || path.indexOf(testFile) > -1) {
+ if (testFile.length === 0 || testFile.some(p => path.includes(p))) {
testsContext(path);
}
} catch (err) {