forked from overleaf/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
62 lines (61 loc) · 1.95 KB
/
karma.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const path = require('path')
module.exports = function (config) {
config.set({
customLaunchers: {
ChromeCustom: {
base: 'ChromeHeadless',
// We must disable the Chrome sandbox when running Chrome inside Docker
// (Chrome's sandbox needs more permissions than Docker allows by
// default)
flags: ['--no-sandbox']
}
},
browsers: ['ChromeCustom'],
files: [
'test/unit_frontend/js/bootstrap.js',
// Angular must be loaded before requirejs to set up angular global
'public/js/libs/angular-1.6.4.min.js',
'public/js/libs/angular-mocks.js',
'public/js/libs/jquery-1.11.1.min.js',
// Set up requirejs
'test/unit_frontend/js/test-main.js',
// 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 },
// 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-webpack'),
require('karma-mocha-reporter')
],
reporters: ['mocha']
});
}