Skip to content

Commit

Permalink
Hacky coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni authored and fatso83 committed Sep 10, 2024
1 parent dd5abde commit e1042ca
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 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 package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test-node": "mocha --recursive -R dot \"test/**/*-test.js\"",
"test-dev": "npm run test-node -- -n watch -n watch-path=test --node-option watch-path=lib -R min",
"test-headless": "mochify --driver puppeteer",
"test-coverage": "nyc npm run test-headless -- --transform [ babelify --ignore [ test ] --plugins [ babel-plugin-istanbul ] ]",
"test-coverage": "nyc nyc --exclude-after-remap false mochify --driver puppeteer --bundle 'node coverage.cjs'",
"test-cloud": "npm run test-headless -- --wd",
"test-webworker": "mochify --driver puppeteer --serve . test/webworker/webworker-support-assessment.js",
"test-esm-support": "mocha test/es2015/module-support-assessment-test.mjs",
Expand Down Expand Up @@ -94,16 +94,18 @@
"@mochify/driver-puppeteer": "^0.4.0",
"@mochify/driver-webdriver": "^0.2.1",
"@sinonjs/eslint-config": "^5.0.3",
"@sinonjs/referee-sinon": "12.0.0",
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.1",
"@sinonjs/referee": "^11.0.1",
"@sinonjs/referee-sinon": "12.0.0",
"@studio/changes": "^3.0.0",
"babel-plugin-istanbul": "^6.1.1",
"babelify": "^10.0.0",
"browserify": "^16.5.2",
"debug": "^4.3.4",
"dependency-check": "^4.1.0",
"esbuild": "^0.23.1",
"esbuild-plugin-istanbul": "^0.3.0",
"get-stdin": "^9.0.0",
"lint-staged": "^15.2.2",
"mocha": "^10.4.0",
"nyc": "^15.1.0",
Expand Down

0 comments on commit e1042ca

Please sign in to comment.