forked from microsoftgraph/microsoft-graph-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-test-runner.config.mjs
54 lines (53 loc) · 1.65 KB
/
web-test-runner.config.mjs
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
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { importMapsPlugin } from '@web/dev-server-import-maps';
import { defaultReporter } from '@web/test-runner';
import { junitReporter } from '@web/test-runner-junit-reporter';
import { fileURLToPath } from 'url';
export default {
concurrency: 10,
nodeResolve: true,
// in a monorepo you need to set set the root dir to resolve modules
rootDir: './',
files: ['packages/**/*.tests.ts'],
testFramework: {
// https://mochajs.org/api/mocha
config: {
ui: 'bdd',
timeout: '60000'
}
},
coverageConfig: {
reporters: ['cobertura', 'lcov']
},
reporters: [
// use the default reporter only for reporting test progress
defaultReporter({ reportTestResults: true, reportTestProgress: true }),
// use another reporter to report test results
junitReporter({
outputPath: './testResults/junit.xml',
reportLogs: true
})
],
plugins: [
importMapsPlugin({
inject: {
importMap: {
imports: {
// mock a dependency
// 'package-a': '/mocks/package-a.js',
// mock a module in your own code
// need to have the query string wds-import-map=0 for this to work.
'/packages/mgt-components/src/graph/graph.userWithPhoto.ts?wds-import-map=0':
'/packages/mgt-components/src/graph/graph.userWithPhoto.mock.ts'
}
}
}
}),
// https://modern-web.dev/docs/dev-server/plugins/esbuild/
esbuildPlugin({
target: 'auto',
ts: true,
tsconfig: fileURLToPath(new URL('./tsconfig.web-test-runner.json', import.meta.url))
})
]
};