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:
-rw-r--r--config/karma.config.js8
-rw-r--r--spec/javascripts/test_bundle.js15
2 files changed, 21 insertions, 2 deletions
diff --git a/config/karma.config.js b/config/karma.config.js
index 9f018d14b8f..609c4780ccc 100644
--- a/config/karma.config.js
+++ b/config/karma.config.js
@@ -12,8 +12,16 @@ if (webpackConfig.plugins) {
plugin instanceof webpack.DefinePlugin
);
});
+} else {
+ webpackConfig.plugins = [];
}
+webpackConfig.plugins.push(
+ new webpack.DefinePlugin({
+ TEST_FILE: JSON.stringify(process.env.TEST_FILE),
+ })
+);
+
webpackConfig.devtool = 'cheap-inline-source-map';
// Karma configuration
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index 6897c991066..8145f905181 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -6,6 +6,7 @@ import '~/commons';
import Vue from 'vue';
import VueResource from 'vue-resource';
+import Translate from '~/vue_shared/translate';
const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent);
Vue.config.devtools = !isHeadlessChrome;
@@ -24,6 +25,7 @@ Vue.config.errorHandler = function (err) {
};
Vue.use(VueResource);
+Vue.use(Translate);
// enable test fixtures
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
@@ -61,11 +63,20 @@ beforeEach(() => {
Vue.http.interceptors = builtinVueHttpInterceptors.slice();
});
-// render all of our tests
+// 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$/, '');
+}
+
const testsContext = require.context('.', true, /_spec$/);
testsContext.keys().forEach(function (path) {
try {
- testsContext(path);
+ if (!testFile || path.indexOf(testFile) > -1) {
+ testsContext(path);
+ }
} catch (err) {
console.error('[ERROR] Unable to load spec: ', path);
describe('Test bundle', function () {