diff --git a/lib/commands/test/karma.js b/lib/commands/test/karma.js index 77555d9..db1d6ef 100644 --- a/lib/commands/test/karma.js +++ b/lib/commands/test/karma.js @@ -36,6 +36,18 @@ function karmaCommand(argv) { }; const webpackConfig = stripes.getStripesWebpackConfig(platform.getStripesConfig(), webpackConfigOptions, context); + // This fixes the warnings similar to: + // WARNING in ./node_modules/mocha/mocha-es2018.js 18541:26-55 + // Critical dependency: the request of a dependency is an expression + // https://github.com/mochajs/mocha/issues/2448#issuecomment-355222358 + webpackConfig.module.exprContextCritical = false; + + // This fixes warning: + // WARNING in DefinePlugin + // Conflicting values for 'process.env.NODE_ENV' + // https://webpack.js.org/configuration/mode/#usage + webpackConfig.mode = 'none'; + const karmaService = new KarmaService(context.cwd); karmaService.runKarmaTests(webpackConfig, Object.assign({}, argv.karma, { watch: argv.watch, cache: argv.cache })); } diff --git a/lib/test/karma-service.js b/lib/test/karma-service.js index 5a5acd0..b0b5e31 100644 --- a/lib/test/karma-service.js +++ b/lib/test/karma-service.js @@ -167,18 +167,6 @@ module.exports = class KarmaService { return karmaConfig; } - // This fixes the warnings similar to: - // WARNING in ./node_modules/mocha/mocha-es2018.js 18541:26-55 - // Critical dependency: the request of a dependency is an expression - // https://github.com/mochajs/mocha/issues/2448#issuecomment-355222358 - webpackConfig.module.exprContextCritical = false; - - // This fixes warning: - // WARNING in DefinePlugin - // Conflicting values for 'process.env.NODE_ENV' - // https://webpack.js.org/configuration/mode/#usage - webpackConfig.mode = 'none'; - // Runs the specified integration tests runKarmaTests(webpackConfig, karmaOptions) { const karmaConfig = this.generateKarmaConfig(webpackConfig, karmaOptions);