diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-03-14 00:54:52 +0300 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-03-14 00:54:52 +0300 |
commit | 2ea8ebfad5c22d53aad2df1228d97a1f53c15947 (patch) | |
tree | d1bcf543eac8c01879eb934a679cdaf49d24cd28 | |
parent | 0c6e4b4c728c32923f1090eaf9927d84d7e78e36 (diff) |
Move EE-specifics of Karma test bundle behind flag
-rw-r--r-- | config/webpack.config.js | 4 | ||||
-rw-r--r-- | spec/javascripts/test_bundle.js | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index 55122e341c3..20b3f4c0264 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -324,6 +324,10 @@ module.exports = { reportFilename: path.join(ROOT_PATH, 'webpack-report/index.html'), statsFilename: path.join(ROOT_PATH, 'webpack-report/stats.json'), }), + + new webpack.DefinePlugin({ + 'process.env.EE': JSON.stringify(IS_EE), + }), ].filter(Boolean), devServer: { diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index 32011375673..d736bc93d70 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -122,10 +122,11 @@ afterEach(() => { const axiosDefaultAdapter = getDefaultAdapter(); // render all of our tests -const testContexts = [ - require.context('spec', true, /_spec$/), - require.context('ee_spec', true, /_spec$/), -]; +const testContexts = [require.context('spec', true, /_spec$/)]; + +if (process.env.EE) { + testContexts.push(require.context('ee_spec', true, /_spec$/)); +} testContexts.forEach(context => { context.keys().forEach(path => { @@ -210,10 +211,12 @@ if (process.env.BABEL_ENV === 'coverage') { ]; describe('Uncovered files', function() { - const sourceFilesContexts = [ - require.context('~', true, /\.(js|vue)$/), - require.context('ee', true, /\.(js|vue)$/), - ]; + const sourceFilesContexts = [require.context('~', true, /\.(js|vue)$/)]; + + if (process.env.EE) { + sourceFilesContexts.push(require.context('ee', true, /\.(js|vue)$/)); + } + const allTestFiles = testContexts.reduce( (accumulator, context) => accumulator.concat(context.keys()), [], |