-
Notifications
You must be signed in to change notification settings - Fork 171
/
karma.conf.js
65 lines (63 loc) · 2.16 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
// Copyright 2020 The OpenZipkin Authors; licensed to You under the Apache License, Version 2.0.
const path = require('path');
const testMiddleware = require('./test/middleware');
module.exports = function(config) {
if (process.env.TEST_SUITE === 'nodejs') {
/* eslint-disable no-console */
console.log('WARN: Skipping browser tests because TEST_SUITE is \'nodejs\'.');
/* eslint-enable no-console */
process.exit(0);
}
config.set({
// resolve to the package not the location of this file
basePath: path.resolve('.'),
failOnEmptyTestSuite: true,
middleware: ['custom'],
plugins: [
{
// This allows http client tests that execute in the browser to be able to hit
// endpoint needed for functional testing such as status code parsing.
//
// Technically, this adds extra endpoints to the karma server (which serves the
// unit tests themselves). Http client tests call relative paths to access these
// endpoints. This is needed because unlike normal node.js tests, we can't start
// a server listener for test endpoints inside the web browser.
'middleware:custom': ['factory', testMiddleware]
},
'karma-mocha',
'karma-browserify',
'karma-chai',
'karma-source-map-support',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-mocha-reporter',
],
frameworks: ['mocha', 'browserify', 'chai', 'source-map-support'],
preprocessors: {
'test/**/*.js': ['browserify']
},
browserify: {
debug: true,
},
files: ['test/**/*.js'],
// unless you use the mocha reporter, you won't see test failure details.
reporters: ['mocha'],
mochaReporter: {
// unless showDiff, you won't see which properties were unexpected
showDiff: true,
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
// see https://github.com/karma-runner/karma-firefox-launcher/issues/76
customLaunchers: {
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless'],
},
},
browsers: ['ChromeHeadless', 'FirefoxHeadless'],
autoWatch: false,
concurrency: Infinity
});
};