-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathkarma-es6.conf.js
More file actions
72 lines (63 loc) · 1.93 KB
/
karma-es6.conf.js
File metadata and controls
72 lines (63 loc) · 1.93 KB
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
// Karma configuration for the "true" ES6 module builds.
const path = require('path');
const fs = require('fs');
// Get the target ES6 build file from an environment variable.
const buildFile = process.env.BUILD_TARGET_ES6 || 'artoolkitNFT_ES6_wasm.js';
const buildFilePath = path.resolve(__dirname, 'build', buildFile);
if (!fs.existsSync(buildFilePath)) {
throw new Error(`[Karma-ES6] Build file not found: ${buildFilePath}\nPlease ensure the build has been generated before running tests.`);
}
console.log(`[Karma-ES6] Using build target: ${buildFile}`);
module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["jasmine", "webpack"],
plugins: ['karma-jasmine', 'karma-webpack', 'karma-chrome-launcher'],
files: [
{ pattern: 'tests/tests-es6.test.js', type: 'module' },
{
pattern: 'examples/Data/*',
watched: false,
included: false,
served: true,
nocache: false
}
],
proxies: {
'/examples/Data/': '/base/examples/Data/'
},
preprocessors: {
'tests/tests-es6.test.js': ['webpack']
},
webpack: {
mode: 'development',
resolve: {
// Create an alias to point to the correct build file.
// This allows the test file to have a static import.
alias: {
'../build/artoolkitNFT_ES6_wasm.js': buildFilePath,
},
fallback: {
"fs": false,
"path": false,
"crypto": false,
"module": false,
}
},
},
reporters: ["progress"],
port: 9879, // A new port for the final test suite
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ["ChromeHeadless"],
singleRun: true,
concurrency: Infinity,
client: {
clearContext: false,
jasmine: {
DEFAULT_TIMEOUT_INTERVAL: 20000
}
}
});
};