1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-14 08:34:32 +00:00

Merge pull request from sharelatex/as-karma-webpack

Use karma-webpack for frontend tests
This commit is contained in:
Alasdair Smith 2018-02-23 13:36:49 +00:00 committed by GitHub
commit 9e14bc4115
3 changed files with 67 additions and 2 deletions

View file

@ -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']

View file

@ -5996,6 +5996,44 @@
"resolved": "https://registry.npmjs.org/karma-requirejs/-/karma-requirejs-1.1.0.tgz",
"dev": true
},
"karma-webpack": {
"version": "2.0.9",
"from": "karma-webpack@>=2.0.9 <3.0.0",
"resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-2.0.9.tgz",
"dev": true,
"dependencies": {
"async": {
"version": "0.9.2",
"from": "async@>=0.9.0 <0.10.0",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
"dev": true
},
"json5": {
"version": "0.5.1",
"from": "json5@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"dev": true
},
"loader-utils": {
"version": "0.2.17",
"from": "loader-utils@>=0.2.5 <0.3.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz",
"dev": true
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.8.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"dev": true
},
"source-map": {
"version": "0.5.7",
"from": "source-map@>=0.5.6 <0.6.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"dev": true
}
}
},
"keygrip": {
"version": "1.0.2",
"from": "keygrip@>=1.0.2 <1.1.0",

View file

@ -125,6 +125,7 @@
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-requirejs": "^1.1.0",
"karma-webpack": "^2.0.9",
"mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"nodemon": "^1.14.3",
"requirejs": "^2.1.22",