mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 11:02:08 +00:00
Configure karma to use webpack for new ES file
This commit is contained in:
parent
6b0b96a357
commit
4e4d9aee89
1 changed files with 28 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
const path = require('path')
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
customLaunchers: {
|
||||
|
@ -21,14 +23,38 @@ module.exports = function (config) {
|
|||
// Include source & test files, but don't "include" them as requirejs
|
||||
// handles this for us
|
||||
{ pattern: 'public/js/**/*.js', included: false },
|
||||
{ pattern: 'test/unit_frontend/js/**/*.js', included: false }
|
||||
{ pattern: 'test/unit_frontend/js/**/*.js', included: false },
|
||||
// Include ES test files
|
||||
'test/unit_frontend/es/**/*.js'
|
||||
],
|
||||
preprocessors: {
|
||||
// Run ES test files through webpack (which will then include source
|
||||
// files in bundle)
|
||||
'test/unit_frontend/es/**/*.js': ['webpack']
|
||||
},
|
||||
frameworks: ['requirejs', 'mocha', 'chai-sinon'],
|
||||
reporters: ['tap'],
|
||||
// Configure webpack in the tests
|
||||
webpack: {
|
||||
resolve: {
|
||||
alias: {
|
||||
// Alias Src in import pathnames to public/es
|
||||
// Cuts down on the amount of ../../ etc
|
||||
Src: path.join(__dirname, 'public/es/')
|
||||
}
|
||||
}
|
||||
},
|
||||
// Configure the webpack dev server used to serve test files
|
||||
webpackMiddleware: {
|
||||
// Disable noisy CLI output
|
||||
stats: 'errors-only'
|
||||
},
|
||||
plugins: [
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-requirejs'),
|
||||
require('karma-mocha'),
|
||||
require('karma-chai-sinon'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-webpack'),
|
||||
require('karma-mocha-reporter')
|
||||
],
|
||||
reporters: ['mocha']
|
||||
|
|
Loading…
Reference in a new issue