-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.conf.js
80 lines (75 loc) · 2.56 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
const tmp = require('tmp');
tmp.setGracefulCleanup();
const webpack = require('webpack');
const outputDir = tmp.dirSync({ unsafeCleanup: true }).name;
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai', 'webpack'],
files: [
'src/**/*.ts',
'test/**/*.spec.ts',
// Required for wasm due to https://github.com/ryanclark/karma-webpack/issues/498. Results
// in an annoying warning before the webpack build, but then it works fine.
{ pattern: `${outputDir}/**/*`, included: false, served: true }
],
mime: { 'text/x-typescript': ['ts'] },
webpack: {
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
configFile: 'test/tsconfig.json',
compilerOptions: {
outDir: tmp.dirSync({ unsafeCleanup: true }).name
}
},
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.ts', '.js'],
fallback: {
util: require.resolve('util/'),
zlib: require.resolve('browserify-zlib'),
assert: require.resolve('assert/'),
buffer: require.resolve('buffer/'),
stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'),
path: false,
fs: false
}
},
experiments: {
asyncWebAssembly: true
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
})
],
output: {
path: outputDir
}
},
webpackMiddleware: {
stats: 'error-only'
},
preprocessors: {
'src/**/*.ts': ['webpack', 'sourcemap'],
'test/**/*.ts': ['webpack', 'sourcemap']
},
reporters: ['spec'],
port: 9876,
logLevel: config.LOG_INFO,
browsers: ['ChromeHeadless'],
autoWatch: false,
singleRun: true,
concurrency: Infinity
});
};