-
-
Notifications
You must be signed in to change notification settings - Fork 769
/
coverage.cjs
43 lines (37 loc) · 1.04 KB
/
coverage.cjs
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
"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);
})();