escover 3.8.1 → 4.0.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/ChangeLog +8 -0
- package/lib/cli/cli.js +1 -9
- package/lib/escover.js +0 -30
- package/lib/register.js +40 -0
- package/package.json +5 -4
package/ChangeLog
CHANGED
package/lib/cli/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ const noop = () => {};
|
|
|
10
10
|
|
|
11
11
|
const {ESCOVER_FORMAT} = process.env;
|
|
12
12
|
|
|
13
|
-
export const ESCOVER_NODE_OPTIONS = '--no-warnings --
|
|
13
|
+
export const ESCOVER_NODE_OPTIONS = '--no-warnings --import escover/register --import mock-import/register';
|
|
14
14
|
|
|
15
15
|
export const cli = ({argv, exit, readCoverage}) => {
|
|
16
16
|
const args = yargsParser(argv.slice(2), {
|
|
@@ -51,14 +51,6 @@ export const cli = ({argv, exit, readCoverage}) => {
|
|
|
51
51
|
export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
|
|
52
52
|
|
|
53
53
|
export function createZenload() {
|
|
54
|
-
/*
|
|
55
|
-
if (!process.version.startsWith('v21'))
|
|
56
|
-
return {
|
|
57
|
-
ZENLOAD: 'escover/fresh,mock-import',
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
console.log('zzzzz');
|
|
61
|
-
*/
|
|
62
54
|
return {
|
|
63
55
|
ZENLOAD: 'escover,mock-import',
|
|
64
56
|
}
|
package/lib/escover.js
CHANGED
|
@@ -24,9 +24,6 @@ const EXCLUDE = [
|
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
export function initialize({port}) {
|
|
27
|
-
globalPreload({port});
|
|
28
|
-
}
|
|
29
|
-
export function globalPreload({port}) {
|
|
30
27
|
port.onmessage = ({data}) => {
|
|
31
28
|
const {
|
|
32
29
|
type,
|
|
@@ -49,33 +46,6 @@ export function globalPreload({port}) {
|
|
|
49
46
|
|
|
50
47
|
writeCoverage();
|
|
51
48
|
};
|
|
52
|
-
|
|
53
|
-
return `(${escover})();`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function escover() {
|
|
57
|
-
const loader = 'escover';
|
|
58
|
-
|
|
59
|
-
global.__createC4 = (url) => ({
|
|
60
|
-
'🧨': (line, column) => {
|
|
61
|
-
port.postMessage({
|
|
62
|
-
type: 'set',
|
|
63
|
-
url,
|
|
64
|
-
line,
|
|
65
|
-
column,
|
|
66
|
-
loader,
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
'init': (line, column) => {
|
|
70
|
-
port.postMessage({
|
|
71
|
-
type: 'init',
|
|
72
|
-
url,
|
|
73
|
-
line,
|
|
74
|
-
column,
|
|
75
|
-
loader,
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
49
|
}
|
|
80
50
|
|
|
81
51
|
export async function load(url, context, defaultLoad) {
|
package/lib/register.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {pathToFileURL} from 'node:url';
|
|
2
|
+
import { register } from 'node:module';
|
|
3
|
+
import { MessageChannel } from 'node:worker_threads';
|
|
4
|
+
|
|
5
|
+
const { port1, port2 } = new MessageChannel();
|
|
6
|
+
|
|
7
|
+
initialize({
|
|
8
|
+
port: port1
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
register('./escover.js', import.meta.url, {
|
|
12
|
+
parentURL: import.meta.url,
|
|
13
|
+
data: { port: port2 },
|
|
14
|
+
transferList: [port2],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function initialize({port}) {
|
|
18
|
+
const loader = 'escover';
|
|
19
|
+
|
|
20
|
+
global.__createC4 = (url) => ({
|
|
21
|
+
'🧨': (line, column) => {
|
|
22
|
+
port.postMessage({
|
|
23
|
+
type: 'set',
|
|
24
|
+
url,
|
|
25
|
+
line,
|
|
26
|
+
column,
|
|
27
|
+
loader,
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
'init': (line, column) => {
|
|
31
|
+
port.postMessage({
|
|
32
|
+
type: 'init',
|
|
33
|
+
url,
|
|
34
|
+
line,
|
|
35
|
+
column,
|
|
36
|
+
loader,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "Coverage for EcmaScript Modules",
|
|
6
6
|
"main": "lib/escover.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"import": "./lib/escover.js"
|
|
18
18
|
},
|
|
19
19
|
"./fresh": "./lib/fresh.js",
|
|
20
|
+
"./register": "./lib/register.js",
|
|
20
21
|
"./plugin": "./lib/instrument/plugin-mark/index.js",
|
|
21
22
|
"./instrument": "./lib/instrument/index.js"
|
|
22
23
|
},
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"montag": "^1.2.1",
|
|
49
50
|
"once": "^1.4.0",
|
|
50
51
|
"picomatch": "^2.3.1",
|
|
51
|
-
"putout": "^
|
|
52
|
+
"putout": "^34.0.0",
|
|
52
53
|
"strip-ansi": "^7.0.1",
|
|
53
54
|
"table": "^6.8.0",
|
|
54
55
|
"try-catch": "^3.0.0",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"zenload": "^2.0.0"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
|
59
|
-
"node": ">=
|
|
60
|
+
"node": ">=18"
|
|
60
61
|
},
|
|
61
62
|
"license": "MIT",
|
|
62
63
|
"devDependencies": {
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"eslint": "^8.3.0",
|
|
67
68
|
"eslint-plugin-n": "^16.0.0",
|
|
68
69
|
"eslint-plugin-putout": "^21.0.2",
|
|
69
|
-
"madrun": "^
|
|
70
|
+
"madrun": "^10.0.0",
|
|
70
71
|
"supertape": "^8.0.1"
|
|
71
72
|
}
|
|
72
73
|
}
|