Skip to content

Commit

Permalink
Use newer @mochify/* packages (#2609)
Browse files Browse the repository at this point in the history
* Try to use newer mochify packages

* working esbuild

* Fix mochify setup

* Hacky coverage

---------

Co-authored-by: Maximilian Antoni <mail@maxantoni.de>
  • Loading branch information
fatso83 and mantoni authored Sep 10, 2024
1 parent 0a5ec52 commit 9715798
Show file tree
Hide file tree
Showing 5 changed files with 3,035 additions and 1,692 deletions.
43 changes: 43 additions & 0 deletions coverage.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use strict";

const esbuild = require("esbuild");
const { esbuildPluginIstanbul } = require("esbuild-plugin-istanbul");

(async function () {
const { default: getStdin } = await import("get-stdin");
const plugins = [
esbuildPluginIstanbul({
filter: /\.js$/,
loader: "js",
name: "istanbul-loader-js",
}),
];
const stdin = {
contents: await getStdin(),
resolveDir: process.cwd(),
sourcefile: "tests.js",
loader: "js",
};

const context = await esbuild.context({
absWorkingDir: process.cwd(),
entryPoints: [],
write: false,
bundle: true,
sourcemap: "inline",
sourcesContent: true,
define: { global: "window", "process.env.NODE_DEBUG": '""' },
external: ["fs"],
target: "es2022",
plugins,
color: true,
stdin,
});

const { outputFiles } = await context.rebuild();
const js = outputFiles[0].text;

context.dispose();

process.stdout.write(js);
})();
25 changes: 25 additions & 0 deletions mochify.webdriver.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

module.exports = {
driver: "webdriver",
// eslint-disable-next-line camelcase
driver_options: {
// Tests must run on a http website for Microsoft Edge to have
// sessionStorage.
url: "http://maxantoni.de/doctype.html",
hostname: "ondemand.saucelabs.com",
path: "/wd/hub",
port: 80,
capabilities: {
browserName: process.env.BROWSER_NAME,
browserVersion: "latest",
"sauce:options": {
build: `${process.env.BROWSER_NAME} ${
process.env.GITHUB_RUN_NUMBER || Date.now()
}`,
username: process.env.SAUCE_USERNAME,
accessKey: process.env.SAUCE_ACCESS_KEY,
},
},
},
};
Loading

0 comments on commit 9715798

Please sign in to comment.