forked from AnalogStudiosRI/www.tuesdaystunes.tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-test-runner.config.js
52 lines (46 loc) · 1.47 KB
/
web-test-runner.config.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
import { defaultReporter } from '@web/test-runner';
// import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css/src/index.js';
import { junitReporter } from '@web/test-runner-junit-reporter';
import path from 'path';
// create a direct instance of ImportCssResource
// const importCssResource = greenwoodPluginImportCss()[0].provider({});
export default {
files: './src/**/*.spec.js',
nodeResolve: true,
reporters: [
defaultReporter({ reportTestResults: true, reportTestProgress: true }),
junitReporter({
outputPath: './reports/test-results.xml'
})
],
coverage: true,
coverageConfig: {
reportDir: './reports'
},
// plugins: [{
// name: 'import-css',
// async transform(context) {
// const { url } = context.request;
// const shouldIntercept = await importCssResource.shouldIntercept(url, context.body, { request: context.headers });
// if (shouldIntercept) {
// const cssResource = await importCssResource.intercept(url, context.body);
// const { body, contentType } = cssResource;
// return {
// body,
// headers: {
// 'content-type': contentType
// }
// };
// }
// }
// }],
middleware: [
function rewriteIndex(context, next) {
const { url } = context.request;
if (url.indexOf('/assets') === 0) {
context.request.url = path.join(process.cwd(), 'src', url);
}
return next();
}
]
};