@jsenv/test 3.3.16 → 3.3.18
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/js/execute_using_dynamic_import.js +2 -2
- package/dist/js/v8_coverage.js +535 -2
- package/dist/jsenv_test.js +35 -61
- package/dist/node_child_process_controlled.mjs +1 -1
- package/dist/node_worker_thread_controlled.mjs +1 -1
- package/package.json +9 -9
- package/src/execution/run.js +1 -2
- package/src/runtime_node/execute_using_dynamic_import.js +1 -2
- package/src/runtime_node/node_child_process_controlled.mjs +1 -2
- package/src/runtime_node/node_worker_thread_controlled.mjs +1 -2
- package/dist/js/exception.js +0 -932
- package/src/execution/exception.js +0 -231
package/dist/jsenv_test.js
CHANGED
|
@@ -3,7 +3,7 @@ import os, { cpus, release, totalmem, availableParallelism, freemem } from "node
|
|
|
3
3
|
import tty from "node:tty";
|
|
4
4
|
import stringWidth from "string-width";
|
|
5
5
|
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
6
|
-
import { URL_META,
|
|
6
|
+
import { URL_META, filterV8Coverage } from "./js/v8_coverage.js";
|
|
7
7
|
import { readdir, chmod, stat, lstat, chmodSync, statSync, lstatSync, promises, readFile as readFile$1, readFileSync, writeFileSync as writeFileSync$1, mkdirSync, unlink, openSync, closeSync, rmdir, unlinkSync, readdirSync, rmdirSync, existsSync } from "node:fs";
|
|
8
8
|
import { dirname } from "node:path";
|
|
9
9
|
import crypto from "node:crypto";
|
|
@@ -12,7 +12,7 @@ import { takeCoverage } from "node:v8";
|
|
|
12
12
|
import stripAnsi from "strip-ansi";
|
|
13
13
|
import { createRequire } from "node:module";
|
|
14
14
|
import { applyBabelPlugins } from "@jsenv/ast";
|
|
15
|
-
import {
|
|
15
|
+
import { createException } from "@jsenv/exception";
|
|
16
16
|
import { createServer } from "node:net";
|
|
17
17
|
import { spawn, spawnSync, fork } from "node:child_process";
|
|
18
18
|
import { SOURCEMAP, generateSourcemapDataUrl } from "@jsenv/sourcemap";
|
|
@@ -2816,7 +2816,6 @@ const writeDirectorySync = (
|
|
|
2816
2816
|
const removeEntrySync = (
|
|
2817
2817
|
source,
|
|
2818
2818
|
{
|
|
2819
|
-
signal = new AbortController().signal,
|
|
2820
2819
|
allowUseless = false,
|
|
2821
2820
|
recursive = false,
|
|
2822
2821
|
maxRetries = 3,
|
|
@@ -2825,51 +2824,36 @@ const removeEntrySync = (
|
|
|
2825
2824
|
} = {},
|
|
2826
2825
|
) => {
|
|
2827
2826
|
const sourceUrl = assertAndNormalizeFileUrl(source);
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
nullIfNotFound: true,
|
|
2836
|
-
followLink: false,
|
|
2837
|
-
});
|
|
2838
|
-
if (!sourceStats) {
|
|
2839
|
-
if (allowUseless) {
|
|
2840
|
-
return;
|
|
2841
|
-
}
|
|
2842
|
-
throw new Error(`nothing to remove at ${urlToFileSystemPath(sourceUrl)}`);
|
|
2827
|
+
const sourceStats = readEntryStatSync(sourceUrl, {
|
|
2828
|
+
nullIfNotFound: true,
|
|
2829
|
+
followLink: false,
|
|
2830
|
+
});
|
|
2831
|
+
if (!sourceStats) {
|
|
2832
|
+
if (allowUseless) {
|
|
2833
|
+
return;
|
|
2843
2834
|
}
|
|
2835
|
+
throw new Error(`nothing to remove at ${urlToFileSystemPath(sourceUrl)}`);
|
|
2836
|
+
}
|
|
2844
2837
|
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
signal: removeOperation.signal,
|
|
2865
|
-
recursive,
|
|
2866
|
-
maxRetries,
|
|
2867
|
-
retryDelay,
|
|
2868
|
-
onlyContent,
|
|
2869
|
-
});
|
|
2870
|
-
}
|
|
2871
|
-
} finally {
|
|
2872
|
-
removeOperation.end();
|
|
2838
|
+
// https://nodejs.org/dist/latest-v13.x/docs/api/fs.html#fs_class_fs_stats
|
|
2839
|
+
// FIFO and socket are ignored, not sure what they are exactly and what to do with them
|
|
2840
|
+
// other libraries ignore them, let's do the same.
|
|
2841
|
+
if (
|
|
2842
|
+
sourceStats.isFile() ||
|
|
2843
|
+
sourceStats.isSymbolicLink() ||
|
|
2844
|
+
sourceStats.isCharacterDevice() ||
|
|
2845
|
+
sourceStats.isBlockDevice()
|
|
2846
|
+
) {
|
|
2847
|
+
removeNonDirectory(
|
|
2848
|
+
sourceUrl.endsWith("/") ? sourceUrl.slice(0, -1) : sourceUrl);
|
|
2849
|
+
} else if (sourceStats.isDirectory()) {
|
|
2850
|
+
const directoryUrl = ensurePathnameTrailingSlash(sourceUrl);
|
|
2851
|
+
removeDirectorySync(directoryUrl, {
|
|
2852
|
+
recursive,
|
|
2853
|
+
maxRetries,
|
|
2854
|
+
retryDelay,
|
|
2855
|
+
onlyContent,
|
|
2856
|
+
});
|
|
2873
2857
|
}
|
|
2874
2858
|
};
|
|
2875
2859
|
|
|
@@ -2904,13 +2888,9 @@ const unlinkSyncNaive = (sourcePath, { handleTemporaryError = null } = {}) => {
|
|
|
2904
2888
|
|
|
2905
2889
|
const removeDirectorySync = (
|
|
2906
2890
|
rootDirectoryUrl,
|
|
2907
|
-
{
|
|
2891
|
+
{ maxRetries, retryDelay, recursive, onlyContent },
|
|
2908
2892
|
) => {
|
|
2909
|
-
const removeDirectoryOperation = Abort.startOperation();
|
|
2910
|
-
removeDirectoryOperation.addAbortSignal(signal);
|
|
2911
|
-
|
|
2912
2893
|
const visit = (sourceUrl) => {
|
|
2913
|
-
removeDirectoryOperation.throwIfAborted();
|
|
2914
2894
|
const sourceStats = readEntryStatSync(sourceUrl, {
|
|
2915
2895
|
nullIfNotFound: true,
|
|
2916
2896
|
followLink: false,
|
|
@@ -2944,7 +2924,6 @@ const removeDirectorySync = (
|
|
|
2944
2924
|
},
|
|
2945
2925
|
}
|
|
2946
2926
|
: {};
|
|
2947
|
-
removeDirectoryOperation.throwIfAborted();
|
|
2948
2927
|
removeDirectorySyncNaive(directoryPath, {
|
|
2949
2928
|
...optionsFromRecursive,
|
|
2950
2929
|
// Workaround for https://github.com/joyent/node/issues/4337
|
|
@@ -2982,7 +2961,6 @@ const removeDirectorySync = (
|
|
|
2982
2961
|
};
|
|
2983
2962
|
|
|
2984
2963
|
const removeDirectoryContent = (directoryUrl) => {
|
|
2985
|
-
removeDirectoryOperation.throwIfAborted();
|
|
2986
2964
|
const entryNames = readdirSync(new URL(directoryUrl));
|
|
2987
2965
|
for (const entryName of entryNames) {
|
|
2988
2966
|
const url = resolveUrl(entryName, directoryUrl);
|
|
@@ -2998,14 +2976,10 @@ const removeDirectorySync = (
|
|
|
2998
2976
|
removeNonDirectory(symbolicLinkUrl);
|
|
2999
2977
|
};
|
|
3000
2978
|
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
visitDirectory(rootDirectoryUrl);
|
|
3006
|
-
}
|
|
3007
|
-
} finally {
|
|
3008
|
-
removeDirectoryOperation.end();
|
|
2979
|
+
if (onlyContent) {
|
|
2980
|
+
removeDirectoryContent(rootDirectoryUrl);
|
|
2981
|
+
} else {
|
|
2982
|
+
visitDirectory(rootDirectoryUrl);
|
|
3009
2983
|
}
|
|
3010
2984
|
};
|
|
3011
2985
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { createException } from "@jsenv/exception";
|
|
1
2
|
import { memoryUsage } from "node:process";
|
|
2
|
-
import { createException } from "./js/exception.js";
|
|
3
3
|
import { executeUsingDynamicImport } from "./js/execute_using_dynamic_import.js";
|
|
4
4
|
import "node:fs";
|
|
5
5
|
import "node:perf_hooks";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { createException } from "@jsenv/exception";
|
|
1
2
|
import { memoryUsage } from "node:process";
|
|
2
3
|
import { setFlagsFromString } from "node:v8";
|
|
3
4
|
import { runInNewContext } from "node:vm";
|
|
4
5
|
import { parentPort } from "node:worker_threads";
|
|
5
|
-
import { createException } from "./js/exception.js";
|
|
6
6
|
import { executeUsingDynamicImport } from "./js/execute_using_dynamic_import.js";
|
|
7
7
|
import "node:fs";
|
|
8
8
|
import "node:perf_hooks";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@c88/v8-coverage": "0.1.1",
|
|
40
40
|
"@jsenv/abort": "4.3.0",
|
|
41
|
-
"@jsenv/ast": "6.2.
|
|
42
|
-
"@jsenv/
|
|
43
|
-
"@jsenv/
|
|
41
|
+
"@jsenv/ast": "6.2.6",
|
|
42
|
+
"@jsenv/exception": "1.0.0",
|
|
43
|
+
"@jsenv/filesystem": "4.9.3",
|
|
44
|
+
"@jsenv/github-check-run": "0.1.25",
|
|
44
45
|
"@jsenv/humanize": "1.2.5",
|
|
45
|
-
"@jsenv/plugin-supervisor": "1.5.
|
|
46
|
-
"@jsenv/sourcemap": "1.2.
|
|
46
|
+
"@jsenv/plugin-supervisor": "1.5.7",
|
|
47
|
+
"@jsenv/sourcemap": "1.2.17",
|
|
47
48
|
"@jsenv/url-meta": "8.4.2",
|
|
48
|
-
"@jsenv/urls": "2.3.
|
|
49
|
-
"@jsenv/utils": "2.1.
|
|
50
|
-
"errorstacks": "2.4.1",
|
|
49
|
+
"@jsenv/urls": "2.3.2",
|
|
50
|
+
"@jsenv/utils": "2.1.2",
|
|
51
51
|
"he": "1.2.0",
|
|
52
52
|
"istanbul-lib-coverage": "3.2.2",
|
|
53
53
|
"istanbul-lib-instrument": "6.0.3",
|
package/src/execution/run.js
CHANGED
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { Abort, raceCallbacks } from "@jsenv/abort";
|
|
14
|
+
import { createException } from "@jsenv/exception";
|
|
14
15
|
import { ensureParentDirectories } from "@jsenv/filesystem";
|
|
15
16
|
import crypto from "node:crypto";
|
|
16
17
|
|
|
17
|
-
import { createException } from "./exception.js";
|
|
18
|
-
|
|
19
18
|
export const run = async ({
|
|
20
19
|
signal = new AbortController().signal,
|
|
21
20
|
logger,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { createException } from "@jsenv/exception";
|
|
1
2
|
import { writeFileSync } from "node:fs";
|
|
2
3
|
import { memoryUsage } from "node:process";
|
|
3
|
-
|
|
4
|
-
import { createException } from "../execution/exception.js";
|
|
5
4
|
import { startObservingPerformances } from "./node_execution_performance.js";
|
|
6
5
|
import { startJsCoverage } from "./profiler_v8_coverage.js";
|
|
7
6
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { createException } from "@jsenv/exception";
|
|
1
2
|
import { memoryUsage } from "node:process";
|
|
2
|
-
|
|
3
|
-
import { createException } from "../execution/exception.js";
|
|
4
3
|
import { executeUsingDynamicImport } from "./execute_using_dynamic_import.js";
|
|
5
4
|
|
|
6
5
|
let memoryHeapUsedAtStart;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { createException } from "@jsenv/exception";
|
|
1
2
|
import { memoryUsage } from "node:process";
|
|
2
3
|
import { setFlagsFromString } from "node:v8";
|
|
3
4
|
import { runInNewContext } from "node:vm";
|
|
4
5
|
import { parentPort } from "node:worker_threads";
|
|
5
|
-
|
|
6
|
-
import { createException } from "../execution/exception.js";
|
|
7
6
|
import { executeUsingDynamicImport } from "./execute_using_dynamic_import.js";
|
|
8
7
|
|
|
9
8
|
setFlagsFromString("--expose_gc");
|