diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-04-11 17:18:09 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-04-11 17:18:09 +0000 |
commit | 54691d3d444e972547d8308b4dda6418e27580d4 (patch) | |
tree | b2f482c349a296c209f2a440dade88db9257a0da /spec/javascripts/test_bundle.js | |
parent | 615f957821204d72f7675e4249bb01984567ccff (diff) | |
parent | bd1b2c665f612f304b68205bdf8fc96fdcfa3112 (diff) | |
download | gitlab-ce-54691d3d444e972547d8308b4dda6418e27580d4.tar.gz |
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.js | 14 |
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() { |