forked from sfu/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
106 lines (86 loc) · 3.2 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
var fs = require("fs");
const glob = require('glob');
var webpackFileExists = false;
var webpackFilePath = __dirname + "/config/WEBPACK";
try {
fs.statSync(webpackFilePath);
webpackFileExists = true;
}
catch (e) {
console.log("no webpack file....")
}
var usingWebpack = (process.env.USE_WEBPACK == 'True' ||
process.env.USE_WEBPACK == 'true' ||
webpackFileExists);
// If we're using webpack, we don't want to load all the requirejs stuff;
var karmaFiles;
if (usingWebpack) {
karmaFiles = [
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/axe.js',
'spec/javascripts/support/redux/fakeStore.js',
{pattern: 'spec/javascripts/webpack/*.bundle.test.js', included: true, served: true},
{pattern: 'spec/javascripts/webpack/*.chunk*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true}
];
} else {
karmaFiles = [
'spec/javascripts/requirejs_config.js',
'public/javascripts/vendor/require.js',
'node_modules/karma-requirejs/lib/adapter.js',
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/sinon/sinon-qunit-1.0.0.js',
'spec/javascripts/support/axe.js',
'spec/javascripts/support/redux/fakeStore.js',
{pattern: 'public/javascripts/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*.html', included: false, served: true},
{pattern: 'spec/javascripts/compiled/*.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/**/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true},
{pattern: 'public/javascripts/**/*.js', included: false, served: true},
{pattern: 'public/dist/brandable_css/**/*.css', included: false, served: true},
'spec/javascripts/load_tests.js'
]
}
var karmaConfig = {
basePath: '',
frameworks: ['qunit'],
files: karmaFiles,
// preprocessors: {
// '**/*.js': ['sourcemap']
// },
proxies: {
"/dist/brandable_css/": "/base/public/dist/brandable_css/"
},
exclude: [],
// 'dots', 'progress', 'junit', 'growl', 'coverage', 'spec'
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'html',
dir: 'coverage-js/',
subdir: '.'
},
port: 9876,
colors: true,
autoWatch: true,
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome', 'PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
browserNoActivityTimeout: 2000000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
};
module.exports = function(config) {
// config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
karmaConfig.logLevel = config.LOG_INFO,
config.set(karmaConfig);
};