-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkarma.conf.ts
78 lines (71 loc) · 2.32 KB
/
karma.conf.ts
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
import * as path from 'path';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { startFridaServer, stopFridaServer } from './test/run-frida-server';
startFridaServer().then((server) => server.unref());
process.on('exit', async (code: number) => {
stopFridaServer();
process.exit(code);
});
const CONTINUOUS = process.env.CONTINUOUS_TEST === 'true';
const HEADFUL = process.env.HEADFUL_TEST === 'true';
const CI = process.env.CI;
module.exports = function(config: any) {
config.set({
frameworks: ['mocha', 'chai'],
files: [
// We only run the main test file - we skip the download tests, which are node-only
'test/test.spec.ts'
],
preprocessors: {
'src/**/*.ts': ['esbuild'],
'test/**/*.ts': ['esbuild']
},
esbuild: {
format: 'esm',
target: 'esnext',
external: [
'./test/run-frida-server',
'child_process',
'net'
],
define: {
'process.env.FIXTURES_PATH': JSON.stringify(path.join(__dirname, 'test', 'fixtures')),
'process.platform': JSON.stringify(process.platform),
'process.arch': JSON.stringify(process.arch),
},
plugins: [
NodeModulesPolyfillPlugin(),
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true
})
]
},
plugins: [
'karma-chrome-launcher',
'karma-chai',
'karma-mocha',
'karma-spec-reporter',
'karma-esbuild'
],
reporters: ['spec'],
port: 9876,
logLevel: config.LOG_INFO,
customLaunchers: {
ChromeCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
browsers:
CI // To run in CI environment:
? ['ChromeCI']
: HEADFUL // Full debugging:
? ['Chrome']
// Normal local usage:
: ['ChromeHeadless'],
autoWatch: CONTINUOUS,
singleRun: !CONTINUOUS
});
};