-
Notifications
You must be signed in to change notification settings - Fork 7
/
web-test-runner.config.mjs
40 lines (38 loc) · 1.22 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
import { importMapsPlugin } from "@web/dev-server-import-maps";
import { fromRollup, rollupAdapter } from "@web/dev-server-rollup";
import rollupReplace from "@rollup/plugin-replace";
import rollupCommonjs from "@rollup/plugin-commonjs";
import rollupImage from "@rollup/plugin-image";
import rollupJson from "@rollup/plugin-json";
import rollupLitCss from "rollup-plugin-lit-css";
const replace = fromRollup(rollupReplace);
const pluginCommonjs = fromRollup(rollupCommonjs);
export default {
rootDir: ".",
files: ["./tests/**/*.test.{js,html}"],
preserveSymlinks: true,
nodeResolve: {},
mimeTypes: {
"**/*.css": "js",
"**/*.svg": "js",
"**/*.json": "js",
},
plugins: [
rollupAdapter(rollupJson()),
rollupAdapter(rollupImage()),
rollupAdapter(rollupLitCss()),
pluginCommonjs({
include: "node_modules/**",
esmExternals: true,
defaultIsModuleExports: true,
requireReturnsDefault: true,
}),
// https://modern-web.dev/docs/dev-server/writing-plugins/examples/#environment-variables
replace({
preventAssignment: true,
include: ["src/**/*.js"],
WEBPACK_IS_TESTING: JSON.stringify(true),
WEBPACK_IS_PRODUCTION: JSON.stringify(false),
}),
],
};