This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathkarma.conf.js
73 lines (59 loc) · 1.49 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
/* eslint-env node */
'use strict';
// 10 minutes
var TEST_TIMEOUT = 10 * 60 * 1000;
module.exports = function(config) {
config.set({
files: [
'test/**/*.test.js'
],
browsers: ['PhantomJS'],
singleRun: true,
middleware: ['server'],
plugins: [
'karma-*',
{
'middleware:server': [
'factory',
function() {
return function(request, response, next) {
if (request.url === '/base/data' && request.method === 'POST') {
var body = '';
request.on('data', function(data) {
body += data;
});
request.on('end', function() {
try {
var data = JSON.parse(body);
response.writeHead(data.length === 3 ? 200 : 400);
return response.end(String(data.length === 3));
} catch (err) {
response.writeHead(500);
return response.end();
}
});
} else {
next();
}
};
}
]
}
],
frameworks: ['browserify', 'mocha'],
reporters: ['spec'],
preprocessors: {
'test/**/*.js': 'browserify'
},
browserNoActivityTimeout: TEST_TIMEOUT,
client: {
mocha: {
grep: process.env.GREP,
timeout: TEST_TIMEOUT
}
},
browserify: {
debug: true
}
});
};