Commit 0c6e4b4c authored by Winnie Hellmann's avatar Winnie Hellmann

Resolve differences in Karma test bundle between CE and EE

parent 1715622c
...@@ -122,10 +122,15 @@ afterEach(() => { ...@@ -122,10 +122,15 @@ afterEach(() => {
const axiosDefaultAdapter = getDefaultAdapter(); const axiosDefaultAdapter = getDefaultAdapter();
// render all of our tests // render all of our tests
const testsContext = require.context('.', true, /_spec$/); const testContexts = [
testsContext.keys().forEach(function(path) { require.context('spec', true, /_spec$/),
require.context('ee_spec', true, /_spec$/),
];
testContexts.forEach(context => {
context.keys().forEach(path => {
try { try {
testsContext(path); context(path);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path); console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
...@@ -135,6 +140,7 @@ testsContext.keys().forEach(function(path) { ...@@ -135,6 +140,7 @@ testsContext.keys().forEach(function(path) {
}); });
}); });
} }
});
}); });
describe('test errors', () => { describe('test errors', () => {
...@@ -204,19 +210,27 @@ if (process.env.BABEL_ENV === 'coverage') { ...@@ -204,19 +210,27 @@ if (process.env.BABEL_ENV === 'coverage') {
]; ];
describe('Uncovered files', function() { describe('Uncovered files', function() {
const sourceFiles = require.context('~', true, /\.(js|vue)$/); const sourceFilesContexts = [
require.context('~', true, /\.(js|vue)$/),
require.context('ee', true, /\.(js|vue)$/),
];
const allTestFiles = testContexts.reduce(
(accumulator, context) => accumulator.concat(context.keys()),
[],
);
$.holdReady(true); $.holdReady(true);
sourceFiles.keys().forEach(function(path) { sourceFilesContexts.forEach(context => {
context.keys().forEach(path => {
// ignore if there is a matching spec file // ignore if there is a matching spec file
if (testsContext.keys().indexOf(`${path.replace(/\.(js|vue)$/, '')}_spec`) > -1) { if (allTestFiles.indexOf(`${path.replace(/\.(js|vue)$/, '')}_spec`) > -1) {
return; return;
} }
it(`includes '${path}'`, function() { it(`includes '${path}'`, function() {
try { try {
sourceFiles(path); context(path);
} catch (err) { } catch (err) {
if (troubleMakers.indexOf(path) === -1) { if (troubleMakers.indexOf(path) === -1) {
expect(err).toBeNull(); expect(err).toBeNull();
...@@ -225,4 +239,5 @@ if (process.env.BABEL_ENV === 'coverage') { ...@@ -225,4 +239,5 @@ if (process.env.BABEL_ENV === 'coverage') {
}); });
}); });
}); });
});
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment