From da755d9e84e706c2d89e7bc592ad922477f37898 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 8 Jun 2018 13:00:10 +0200 Subject: [PATCH] Make tests (and sourcemap) work with webpack4 --- test/index.html | 58 -------------------------------------------- test/index_test.js | 5 ++++ test/karma.config.js | 15 ++++++++---- 3 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 test/index.html create mode 100644 test/index_test.js diff --git a/test/index.html b/test/index.html deleted file mode 100644 index 9e79a0bb0a..0000000000 --- a/test/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - OL Spec Runner - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/test/index_test.js b/test/index_test.js new file mode 100644 index 0000000000..5203db1f25 --- /dev/null +++ b/test/index_test.js @@ -0,0 +1,5 @@ +// require all modules ending in ".test.js" from the +// current directory and all subdirectories +const testsContext = require.context('.', true, /\.test\.js$/); + +testsContext.keys().forEach(testsContext); diff --git a/test/karma.config.js b/test/karma.config.js index 9288370a9d..5416708aa8 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -39,26 +39,31 @@ module.exports = function(karma) { }, { pattern: path.resolve(__dirname, './test-extensions.js') }, { - pattern: '**/*.test.js' + pattern: path.resolve(__dirname, './index_test.js'), + watched: false }, { pattern: '**/*', included: false, watched: false } ], + exclude: [ + '**/*.test.js' + ], proxies: { '/rendering/': '/base/rendering/', '/spec/': '/base/spec/' }, preprocessors: { - '**/*.js': ['webpack'] + '**/*.js': ['webpack', 'sourcemap'] }, reporters: ['progress'], + webpack: { + devtool: 'inline-source-map', + mode: 'development' + }, webpackMiddleware: { noInfo: true - }, - webpack: { - mode: 'development' } });