escover 3.8.0 → 3.8.1
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 +6 -0
- package/lib/cli/cli.js +15 -1
- package/lib/escover.js +4 -0
- package/lib/fresh.js +30 -0
- package/package.json +4 -3
package/ChangeLog
CHANGED
package/lib/cli/cli.js
CHANGED
|
@@ -50,11 +50,25 @@ export const cli = ({argv, exit, readCoverage}) => {
|
|
|
50
50
|
|
|
51
51
|
export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
|
|
52
52
|
|
|
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
|
+
return {
|
|
63
|
+
ZENLOAD: 'escover,mock-import',
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
function execute(cmd, exit) {
|
|
54
68
|
const [error] = tryCatch(execSync, cmd, {
|
|
55
69
|
stdio: [0, 1, 2],
|
|
56
70
|
env: {
|
|
57
|
-
|
|
71
|
+
...createZenload,
|
|
58
72
|
...process.env,
|
|
59
73
|
NODE_OPTIONS: ESCOVER_NODE_OPTIONS,
|
|
60
74
|
},
|
package/lib/escover.js
CHANGED
|
@@ -23,6 +23,9 @@ const EXCLUDE = [
|
|
|
23
23
|
...exclude,
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
+
export function initialize({port}) {
|
|
27
|
+
globalPreload({port});
|
|
28
|
+
}
|
|
26
29
|
export function globalPreload({port}) {
|
|
27
30
|
port.onmessage = ({data}) => {
|
|
28
31
|
const {
|
|
@@ -109,6 +112,7 @@ export async function load(url, context, defaultLoad) {
|
|
|
109
112
|
return {
|
|
110
113
|
format,
|
|
111
114
|
source,
|
|
115
|
+
shortCircuit: true,
|
|
112
116
|
};
|
|
113
117
|
}
|
|
114
118
|
|
package/lib/fresh.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fileURLToPath,
|
|
3
|
+
pathToFileURL,
|
|
4
|
+
} from 'node:url';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import {register} from 'node:module';
|
|
7
|
+
import {MessageChannel} from 'node:worker_threads';
|
|
8
|
+
|
|
9
|
+
// This example showcases how a message channel can be used to communicate
|
|
10
|
+
// between the main (application) thread and the hooks running on the hooks
|
|
11
|
+
// thread, by sending `port2` to the `initialize` hook.
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
// This example showcases how a message channel can be used to communicate
|
|
14
|
+
// between the main (application) thread and the hooks running on the hooks
|
|
15
|
+
// thread, by sending `port2` to the `initialize` hook.
|
|
16
|
+
const {port1, port2} = new MessageChannel();
|
|
17
|
+
|
|
18
|
+
port1.on('message', (msg) => {
|
|
19
|
+
assert.strictEqual(msg, 'increment: 2');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
register('./escover.js', {
|
|
23
|
+
parentURL: pathToFileURL(__filename),
|
|
24
|
+
data: {
|
|
25
|
+
number: 1,
|
|
26
|
+
port: port2,
|
|
27
|
+
},
|
|
28
|
+
transferList: [port2],
|
|
29
|
+
});
|
|
30
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.1",
|
|
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",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"import": "./lib/escover.js"
|
|
18
18
|
},
|
|
19
|
+
"./fresh": "./lib/fresh.js",
|
|
19
20
|
"./plugin": "./lib/instrument/plugin-mark/index.js",
|
|
20
21
|
"./instrument": "./lib/instrument/index.js"
|
|
21
22
|
},
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"montag": "^1.2.1",
|
|
48
49
|
"once": "^1.4.0",
|
|
49
50
|
"picomatch": "^2.3.1",
|
|
50
|
-
"putout": "^
|
|
51
|
+
"putout": "^33.0.0",
|
|
51
52
|
"strip-ansi": "^7.0.1",
|
|
52
53
|
"table": "^6.8.0",
|
|
53
54
|
"try-catch": "^3.0.0",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"escover": "^3.2.0",
|
|
65
66
|
"eslint": "^8.3.0",
|
|
66
67
|
"eslint-plugin-n": "^16.0.0",
|
|
67
|
-
"eslint-plugin-putout": "^
|
|
68
|
+
"eslint-plugin-putout": "^21.0.2",
|
|
68
69
|
"madrun": "^9.0.0",
|
|
69
70
|
"supertape": "^8.0.1"
|
|
70
71
|
}
|