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:
authorClement Ho <clemmakesapps@gmail.com>2018-04-11 20:18:09 +0300
committerClement Ho <clemmakesapps@gmail.com>2018-04-11 20:18:09 +0300
commit54691d3d444e972547d8308b4dda6418e27580d4 (patch)
treeb2f482c349a296c209f2a440dade88db9257a0da /spec/javascripts/test_bundle.js
parent615f957821204d72f7675e4249bb01984567ccff (diff)
parentbd1b2c665f612f304b68205bdf8fc96fdcfa3112 (diff)
Merge branch 'winh-single-karma-test' into 'master'
Add possibility to filter Karma spec files by path Closes #40899 See merge request gitlab-org/gitlab-ce!16102
Diffstat (limited to 'spec/javascripts/test_bundle.js')
-rw-r--r--spec/javascripts/test_bundle.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index f595feec949..14bff05e537 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -5,6 +5,7 @@ import '~/commons';
import Vue from 'vue';
import VueResource from 'vue-resource';
+import Translate from '~/vue_shared/translate';
import { getDefaultAdapter } from '~/lib/utils/axios_utils';
import { FIXTURES_PATH, TEST_HOST } from './test_constants';
@@ -28,6 +29,7 @@ Vue.config.errorHandler = function(err) {
};
Vue.use(VueResource);
+Vue.use(Translate);
// enable test fixtures
jasmine.getFixtures().fixturesPath = FIXTURES_PATH;
@@ -70,11 +72,21 @@ beforeEach(() => {
const axiosDefaultAdapter = getDefaultAdapter();
+let testFiles = process.env.TEST_FILES || [];
+if (testFiles.length > 0) {
+ testFiles = testFiles.map(path => path.replace(/^spec\/javascripts\//, '').replace(/\.js$/, ''));
+ console.log(`Running only tests matching: ${testFiles}`);
+} else {
+ console.log('Running all tests');
+}
+
// render all of our tests
const testsContext = require.context('.', true, /_spec$/);
testsContext.keys().forEach(function(path) {
try {
- testsContext(path);
+ if (testFiles.length === 0 || testFiles.some(p => path.includes(p))) {
+ testsContext(path);
+ }
} catch (err) {
console.error('[ERROR] Unable to load spec: ', path);
describe('Test bundle', function() {