generated from dunglas/symfony-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweb-test-runner.config.mjs
42 lines (39 loc) · 1.17 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
import {playwrightLauncher} from "@web/test-runner-playwright";
const browsers = {
// Local browser testing via playwright
chromium: playwrightLauncher({product: "chromium"}),
firefox: playwrightLauncher({product: "firefox"}),
webkit: playwrightLauncher({product: "webkit"}),
};
// Prepend BROWSERS=x,y to `npm run test` to run a subset of browsers
// e.g. `BROWSERS=chromium,firefox npm run test`
const noBrowser = (b) => {
throw new Error(`No browser configured named '${b}'; using defaults`);
};
let commandLineBrowsers;
try {
// eslint-disable-next-line no-undef
if (typeof process.env.BROWSERS !== "undefined") {
// eslint-disable-next-line no-undef
commandLineBrowsers = process.env.BROWSERS.split(",").map(
(b) => (typeof browsers[b] != "undefined" ? browsers[b] : noBrowser(b))
);
}
} catch (e) {
console.warn(e);
}
// https://modern-web.dev/docs/test-runner/cli-and-configuration/
export default {
rootDir: ".",
files: ["./tests/Frontend/Unit/**/*.test.js"],
nodeResolve: true,
preserveSymlinks: true,
browsers: commandLineBrowsers || Object.values(browsers),
testFramework: {
// https://mochajs.org/api/mocha
config: {
ui: "bdd",
},
},
plugins: [],
};