UNPKG

2.19 kBJavaScriptView Raw
1// Karma configuration
2
3module.exports = function configureKarma(config) {
4 config.set({
5 // base path that will be used to resolve all patterns (eg. files, exclude)
6 basePath: '',
7
8 // frameworks to use
9 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10 frameworks: ['browserify', 'mocha', 'expect'],
11
12 // list of files / patterns to load in the browser
13 files: [
14 'test/spec-build/*.spec.js',
15 { pattern : 'test/thread-scripts/*.js', included : false }
16 ],
17
18 // list of files to exclude
19 exclude: [
20 '**/*.swp'
21 ],
22
23 // preprocess matching files before serving them to the browser
24 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
25 preprocessors: {
26 'test/spec-build/*.spec.js': ['browserify']
27 },
28
29 browserify: {
30 debug : true,
31 configure(bundle) {
32 bundle.on('prebundle', () => {
33 bundle.require('./lib/worker.browser/worker.js', { expose : './worker' }) // keep the node worker out of the bundle
34 });
35 }
36 },
37
38 // test results reporter to use
39 // possible values: 'dots', 'progress'
40 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
41 reporters: ['progress'],
42
43 // web server port
44 port: 9876,
45
46 // enable / disable colors in the output (reporters and logs)
47 colors: true,
48
49 // level of logging
50 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
51 logLevel: config.LOG_INFO,
52
53 // enable / disable watching file and executing tests whenever any file changes
54 autoWatch: true,
55
56 browserNoActivityTimeout: 10000,
57
58 // start these browsers
59 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
60 browsers: ['ChromeHeadlessInsecure', 'Firefox'],
61
62 customLaunchers: {
63 ChromeHeadlessInsecure: {
64 base: 'ChromeHeadless',
65 flags: ['--disable-web-security', '--headless', '--no-sandbox']
66 }
67 },
68
69 // Continuous Integration mode
70 // if true, Karma captures browsers, runs the tests and exits
71 singleRun: true
72 });
73};