forked from apollo-elements/apollo-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-test-runner.config.js
More file actions
76 lines (65 loc) · 1.79 KB
/
web-test-runner.config.js
File metadata and controls
76 lines (65 loc) · 1.79 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
73
74
75
76
// @ts-check
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { fromRollup } from '@web/dev-server-rollup';
import { sendKeysPlugin } from '@web/test-runner-commands/plugins';
import _commonjs from '@rollup/plugin-commonjs';
import _graphql from '@apollo-elements/rollup-plugin-graphql';
const graphql = fromRollup(_graphql);
const commonjs = fromRollup(_commonjs);
const cjsIncludes = [
'**/fast-json-stable-stringify/index.js',
'**/graphql-tag/src/index.js',
'**/zen-observable/**/*.js',
'**/incremental-dom/dist/*cjs.js',
];
/** @type {Partial<import('@web/test-runner').TestRunnerConfig>} */
export default ({
nodeResolve: {
exportConditions: ['default', 'esbuild', 'import'],
extensions: ['.mjs', '.js', '.ts', '.css', '.graphql'],
},
rootDir: '../..',
files: [
'packages/!(create)/**/*.test.ts',
],
mimeTypes: {
'**/*.graphql': 'js',
},
coverageConfig: {
exclude: [
'_site/**/*',
'_site-dev/**/*',
'.vscode/**/*',
'.netlify/**/*',
'coverage/**/*',
'packages/**/*.test.{ts, js}',
'packages/lib/cuid.{ts, js}',
'**/node_modules/**/*',
'**/test/**/*',
'*__*-dev-server__*',
],
},
testRunnerHtml: testRunnerImport => `
<html>
<head>
<script>
// @ts-ignore: https://github.com/graphql/graphql-js/pull/2409
globalThis.process ??= { env: {} };
// suppress advertising
globalThis.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ = () => void 0;
</script>
</head>
<body>
<script type="module">
import '${testRunnerImport}';
</script>
</body>
</html>
`,
plugins: [
graphql(),
commonjs({ include: cjsIncludes, ignoreDynamicRequires: false }),
esbuildPlugin({ ts: true }),
sendKeysPlugin(),
],
});