-
Notifications
You must be signed in to change notification settings - Fork 290
/
karma.conf.js
165 lines (162 loc) · 4.63 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
const path = require('path');
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) {
config.set({
reporters: ['junit', 'coverage', 'spec'],
client: {
jasmine: {
random: false, // don't randomize the order of tests
stopOnFailure: false,
failFast: false,
},
// Set to true to capture WARN level logging
// See browserConsoleLogOptions for setting other log levels
captureConsole: true,
clearContext: false,
},
concurrency: 1,
// Uncomment this out to capture all logging
// browserConsoleLogOptions: {
// terminal: true,
// level: '',
// },
specReporter: {
maxLogLines: 5, // limit number of lines logged per test
suppressSummary: true, // do not print summary
suppressErrorSummary: true, // do not print error summary
suppressFailed: false, // do not print information about failed tests
suppressPassed: false, // do not print information about passed tests
suppressSkipped: true, // do not print information about skipped tests
showSpecTiming: false, // print the time elapsed for each spec
failFast: false, // test would finish with error when a first fail occurs
prefixes: {
success: ' PASS: ', // override prefix for passed tests, default is '✓ '
failure: 'FAILED: ', // override prefix for failed tests, default is '✗ '
skipped: 'SKIPPED: ', // override prefix for skipped tests, default is '- '
},
},
junitReporter: {
outputDir: 'junit',
outputFile: 'test-results.xml',
},
plugins: [
'karma-webpack',
'karma-jasmine',
'karma-chrome-launcher',
// Reports / Output
'karma-junit-reporter',
'karma-coverage',
'karma-spec-reporter',
],
frameworks: ['jasmine', 'webpack'],
customHeaders: [
{
match: '.*.html',
name: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
{
match: '.*.html',
name: 'Cross-Origin-Embedder-Policy',
value: 'require-corp',
},
],
files: [
'packages/core/test/**/*_test.js',
'packages/tools/test/**/*_test.js',
],
preprocessors: {
'packages/core/test/**/*_test.js': ['webpack'],
'packages/tools/test/**/*_test.js': ['webpack'],
},
coverageReporter: {
type: 'html',
dir: 'coverage/',
},
// The default of 2 seconds is a bit short for some tests
browserNoActivityTimeout: 6000,
browserDisconnectTimeout: 6000,
/*webpackMiddleware: {
noInfo: true
},*/
webpack: {
devtool: 'eval-source-map',
mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [['babel-plugin-istanbul', {}]],
},
},
},
{
test: /\.wasm/,
type: 'asset/inline',
},
{
test: /\.png$/i,
use: [
{
loader: 'url-loader',
},
],
},
{
test: /\.wasm/,
type: 'asset/resource',
},
// NOTE: For better debugging you can comment out the
// istanbul-instrumenter-loader below
// {
// test: /\.ts$/,
// exclude: [path.resolve(__dirname, 'test')],
// enforce: 'post',
// use: {
// loader: 'istanbul-instrumenter-loader',
// options: { esModules: true },
// },
// },
],
},
experiments: {
asyncWebAssembly: true,
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
fallback: {
fs: false,
path: require.resolve('path-browserify'),
},
alias: {
'@cornerstonejs/core': path.resolve('packages/core/src/index'),
'@cornerstonejs/tools': path.resolve('packages/tools/src/index'),
},
},
},
webpackMiddleware: {
noInfo: false,
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--disable-translate',
'--disable-extensions',
'--no-sandbox',
'--ignore-gpu-blacklist',
'--remote-debugging-port=9229',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
// browsers: ['Chrome'],
// singleRun: true,
// colors: true,
// autoWatch: true,
});
};