@jsenv/test 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllable_child_process.mjs +73 -66
- package/dist/controllable_worker_thread.mjs +62 -49
- package/dist/importmap_node_loader.mjs +286 -185
- package/dist/js/execute_using_dynamic_import.js +397 -282
- package/dist/js/v8_coverage.js +91 -98
- package/dist/jsenv_test.js +2620 -1918
- package/dist/no_experimental_warnings.cjs +4 -1
- package/package.json +6 -6
- package/src/coverage/babel_plugin_instrument.js +10 -8
- package/src/coverage/empty_coverage_factory.js +3 -4
- package/src/runtime_browsers/middleware_istanbul.js +6 -8
- package/src/runtime_browsers/middleware_js_supervisor.js +1 -1
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
const originalEmit = process.emit;
|
|
3
3
|
process.emit = (event, error) => {
|
|
4
4
|
if (event === "warning" && error.name === "ExperimentalWarning") {
|
|
5
|
-
if (
|
|
5
|
+
if (
|
|
6
|
+
error.message.includes("--experimental-loader") ||
|
|
7
|
+
error.message.includes("Custom ESM Loaders is an experimental")
|
|
8
|
+
) {
|
|
6
9
|
return false;
|
|
7
10
|
}
|
|
8
11
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/jsenv/core",
|
|
8
|
-
"directory": "packages/
|
|
8
|
+
"directory": "packages/related/test"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@jsenv/abort": "4.2.4",
|
|
37
|
-
"@jsenv/ast": "4.0
|
|
37
|
+
"@jsenv/ast": "4.1.0",
|
|
38
38
|
"@jsenv/filesystem": "4.2.3",
|
|
39
39
|
"@jsenv/log": "3.3.5",
|
|
40
|
-
"@jsenv/plugin-supervisor": "1.
|
|
40
|
+
"@jsenv/plugin-supervisor": "1.1.1",
|
|
41
41
|
"@jsenv/urls": "2.0.0",
|
|
42
42
|
"@jsenv/url-meta": "8.1.0",
|
|
43
43
|
"@jsenv/uneval": "1.6.0",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"istanbul-lib-instrument": "5.2.1",
|
|
48
48
|
"istanbul-lib-report": "3.0.0",
|
|
49
49
|
"istanbul-reports": "3.1.5",
|
|
50
|
-
"@paralleldrive/cuid2": "2.2.
|
|
50
|
+
"@paralleldrive/cuid2": "2.2.1",
|
|
51
51
|
"@c88/v8-coverage": "0.1.1",
|
|
52
|
-
"strip-ansi": "7.0
|
|
52
|
+
"strip-ansi": "7.1.0",
|
|
53
53
|
"wrap-ansi": "8.1.0",
|
|
54
54
|
"pidtree": "0.6.0"
|
|
55
55
|
}
|
|
@@ -10,8 +10,8 @@ export const babelPluginInstrument = (api, { useInlineSourceMaps = false }) => {
|
|
|
10
10
|
name: "transform-instrument",
|
|
11
11
|
visitor: {
|
|
12
12
|
Program: {
|
|
13
|
-
enter(path) {
|
|
14
|
-
const { file } =
|
|
13
|
+
enter(path, state) {
|
|
14
|
+
const { file } = state;
|
|
15
15
|
const { opts } = file;
|
|
16
16
|
let inputSourceMap;
|
|
17
17
|
if (useInlineSourceMaps) {
|
|
@@ -23,7 +23,7 @@ export const babelPluginInstrument = (api, { useInlineSourceMaps = false }) => {
|
|
|
23
23
|
} else {
|
|
24
24
|
inputSourceMap = opts.inputSourceMap;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
const __dv__ = programVisitor(
|
|
27
27
|
types,
|
|
28
28
|
opts.filenameRelative || opts.filename,
|
|
29
29
|
{
|
|
@@ -31,16 +31,18 @@ export const babelPluginInstrument = (api, { useInlineSourceMaps = false }) => {
|
|
|
31
31
|
inputSourceMap,
|
|
32
32
|
},
|
|
33
33
|
);
|
|
34
|
-
|
|
34
|
+
__dv__.enter(path);
|
|
35
|
+
file.metadata.__dv__ = __dv__;
|
|
35
36
|
},
|
|
36
37
|
|
|
37
|
-
exit(path) {
|
|
38
|
-
|
|
38
|
+
exit(path, state) {
|
|
39
|
+
const { __dv__ } = state.file.metadata;
|
|
40
|
+
if (!__dv__) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
|
-
const object =
|
|
43
|
+
const object = __dv__.exit(path);
|
|
42
44
|
// object got two properties: fileCoverage and sourceMappingURL
|
|
43
|
-
|
|
45
|
+
state.file.metadata.coverage = object.fileCoverage;
|
|
44
46
|
},
|
|
45
47
|
},
|
|
46
48
|
},
|
|
@@ -20,10 +20,9 @@ export const relativeUrlToEmptyCoverage = async (
|
|
|
20
20
|
operation.throwIfAborted();
|
|
21
21
|
const { metadata } = await applyBabelPlugins({
|
|
22
22
|
babelPlugins: [babelPluginInstrument],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
23
|
+
input: content,
|
|
24
|
+
inputIsJsModule: false,
|
|
25
|
+
inputUrl: fileUrl,
|
|
27
26
|
});
|
|
28
27
|
const { coverage } = metadata;
|
|
29
28
|
if (!coverage) {
|
|
@@ -30,14 +30,12 @@ export const initIstanbulMiddleware = async (
|
|
|
30
30
|
try {
|
|
31
31
|
const result = await applyBabelPlugins({
|
|
32
32
|
babelPlugins: [babelPluginInstrument],
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
content: originalBody,
|
|
40
|
-
},
|
|
33
|
+
input: originalBody,
|
|
34
|
+
// jsenv server could send info to know it's a js module or js classic
|
|
35
|
+
// but in the end it's not super important
|
|
36
|
+
// - it's ok to parse js classic as js module considering it's only for istanbul instrumentation
|
|
37
|
+
inputIsJsModule: true,
|
|
38
|
+
inputUrl: fileUrl,
|
|
41
39
|
});
|
|
42
40
|
let code = result.code;
|
|
43
41
|
code = SOURCEMAP.writeComment({
|
|
@@ -3,7 +3,7 @@ import { urlToExtension } from "@jsenv/urls";
|
|
|
3
3
|
import {
|
|
4
4
|
injectSupervisorIntoHTML,
|
|
5
5
|
supervisorFileUrl,
|
|
6
|
-
} from "@jsenv/plugin-supervisor
|
|
6
|
+
} from "@jsenv/plugin-supervisor";
|
|
7
7
|
|
|
8
8
|
export const initJsSupervisorMiddleware = async (
|
|
9
9
|
page,
|