forked from BabylonJS/Babylon.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest-puppeteer.config.js
62 lines (52 loc) · 1.95 KB
/
jest-puppeteer.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
53
54
55
56
57
58
59
60
61
62
// const buildTools = require("@dev/build-tools");
// const engine = buildTools.checkArgs("--engine", false, true) || "webgl2";
// const headless = buildTools.checkArgs("--headless", true);
// const browser = buildTools.checkArgs("--browser", false, true) || "chrome";
// const puppeteer = require("puppeteer");
// jest has no support for CLI
const headless = process.env.HEADLESS === "true";
const browser = process.env.BROWSER || "chrome";
const engineType = process.env.TEST_ENGINE || "webgl2";
const gpuType = process.env.TEST_GPU || ""; // egl, desktop or nothing
const costumeFlags = engineType === "webgpu" ? ["--enable-unsafe-webgpu"] : [];
const browserPath = process.env.BROWSER_PATH || "";
// console.log(process.env, headless, gpuType);
const chromeFlags = [
"--js-flags=--expose-gc",
"--enable-unsafe-webgpu",
// "--no-sandbox",
// "--disable-setuid-sandbox",
// // "--gpu",
// "--enable-webgl2-compute-context",
// "--enable-webgl-image-chromium",
// // "--ignore-gpu-blocklist",
// // "--enable-gpu-rasterization",
// "--enable-zero-copy",
// // "--disable-gpu-driver-bug-workarounds",
// "--enable-gpu-compositing",
// "--use-gl=egl",
// "--use-gl=desktop",
/*"--window-size=600x400",*/
...costumeFlags,
];
if(gpuType) {
chromeFlags.push(`--use-gl=${gpuType}`);
}
// if(headless) {
// chromeFlags.push("--use-gl=egl");
// }
const firefoxFlags = ["-wait-for-browser"];
module.exports = {
launch: {
dumpio: false, // should we see logs?
timeout: 30000, // 30 seconds
headless: headless, // false to open a browser
product: browser,
ignoreHTTPSErrors: true,
// devtools: true,
// channel: "chrome-canary",
args: browser === "chrome" ? chromeFlags : firefoxFlags, // additional arguments for Chrome
executablePath: browserPath,
},
browserContext: "default",
};