Skip to content

Commit 9715798

Browse files
fatso83mantoni
andauthored
Use newer @mochify/* packages (#2609)
* Try to use newer mochify packages * working esbuild * Fix mochify setup * Hacky coverage --------- Co-authored-by: Maximilian Antoni <mail@maxantoni.de>
1 parent 0a5ec52 commit 9715798

File tree

5 files changed

+3035
-1692
lines changed

5 files changed

+3035
-1692
lines changed

coverage.cjs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"use strict";
2+
3+
const esbuild = require("esbuild");
4+
const { esbuildPluginIstanbul } = require("esbuild-plugin-istanbul");
5+
6+
(async function () {
7+
const { default: getStdin } = await import("get-stdin");
8+
const plugins = [
9+
esbuildPluginIstanbul({
10+
filter: /\.js$/,
11+
loader: "js",
12+
name: "istanbul-loader-js",
13+
}),
14+
];
15+
const stdin = {
16+
contents: await getStdin(),
17+
resolveDir: process.cwd(),
18+
sourcefile: "tests.js",
19+
loader: "js",
20+
};
21+
22+
const context = await esbuild.context({
23+
absWorkingDir: process.cwd(),
24+
entryPoints: [],
25+
write: false,
26+
bundle: true,
27+
sourcemap: "inline",
28+
sourcesContent: true,
29+
define: { global: "window", "process.env.NODE_DEBUG": '""' },
30+
external: ["fs"],
31+
target: "es2022",
32+
plugins,
33+
color: true,
34+
stdin,
35+
});
36+
37+
const { outputFiles } = await context.rebuild();
38+
const js = outputFiles[0].text;
39+
40+
context.dispose();
41+
42+
process.stdout.write(js);
43+
})();

mochify.webdriver.cjs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
3+
module.exports = {
4+
driver: "webdriver",
5+
// eslint-disable-next-line camelcase
6+
driver_options: {
7+
// Tests must run on a http website for Microsoft Edge to have
8+
// sessionStorage.
9+
url: "http://maxantoni.de/doctype.html",
10+
hostname: "ondemand.saucelabs.com",
11+
path: "/wd/hub",
12+
port: 80,
13+
capabilities: {
14+
browserName: process.env.BROWSER_NAME,
15+
browserVersion: "latest",
16+
"sauce:options": {
17+
build: `${process.env.BROWSER_NAME} ${
18+
process.env.GITHUB_RUN_NUMBER || Date.now()
19+
}`,
20+
username: process.env.SAUCE_USERNAME,
21+
accessKey: process.env.SAUCE_ACCESS_KEY,
22+
},
23+
},
24+
},
25+
};

0 commit comments

Comments
 (0)