forked from jvilk/BrowserFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.config.js
81 lines (78 loc) · 2.17 KB
/
karma.config.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
'use strict';
const express = require('express');
const detectBrowsers = require('detect-browsers');
const seenBrowsers = {};
const isTravis = process.env.TRAVIS;
// Browser detection does not work properly on Travis.
const installedBrowsers = isTravis ? ['Firefox'] : detectBrowsers.getInstalledBrowsers()
.map(function(browser) { return browser.name; })
.filter(function(browser) {
if (seenBrowsers[browser]) {
return false;
} else {
seenBrowsers[browser] = true;
return true;
}
});
let dropbox = false;
let continuous = false;
let coverage = false;
let karmaFiles = [
// Main module and fixtures loader
'test/harness/test.js',
// WebWorker script.
{ pattern: 'test/harness/factories/workerfs_worker.js', included: false, watched: true }
];
// The presence of the Dropbox library dynamically toggles the tests.
if (dropbox) {
karmaFiles.unshift('node_modules/dropbox/lib/dropbox.js');
}
module.exports = function(configSetter) {
let config = {
basePath: __dirname,
frameworks: ['mocha'],
files: karmaFiles,
exclude: [],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: 'INFO',
autoWatch: true,
concurrency: 1,
browsers: installedBrowsers,
captureTimeout: 60000,
singleRun: !continuous,
urlRoot: '/',
// Dropbox tests are slow.
browserNoActivityTimeout: 30000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
preprocessors: {},
coverageReporter: undefined,
client: {
mocha: {
// Stop tests after first failure.
// Our tests have some global state (e.g. # of pending callbacks). Once those get messed up by a failing test,
// subsequent tests are likely to fail.
bail: true
}
},
middleware: ['static'],
plugins: [
'karma-*',
{
'middleware:static': ['factory', function() {
return express.static(__dirname);
}]
}
]
};
if (coverage) {
config.reporters.push('coverage');
config.preprocessors = {
'./test/harness/**/*.js': ['coverage']
};
config.coverageReporter = { type: 'json', dir: 'coverage/' };
}
configSetter.set(config);
};