@jsenv/test 3.7.6 → 3.7.8
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/jsenv_test.js
CHANGED
|
@@ -1844,7 +1844,7 @@ const resolveUrl = (specifier, baseUrl) => {
|
|
|
1844
1844
|
return String(new URL(specifier, baseUrl));
|
|
1845
1845
|
};
|
|
1846
1846
|
|
|
1847
|
-
const
|
|
1847
|
+
const urlIsOrIsInsideOf = (url, otherUrl) => {
|
|
1848
1848
|
const urlObject = new URL(url);
|
|
1849
1849
|
const otherUrlObject = new URL(otherUrl);
|
|
1850
1850
|
|
|
@@ -1855,7 +1855,7 @@ const urlIsInsideOf = (url, otherUrl) => {
|
|
|
1855
1855
|
const urlPathname = urlObject.pathname;
|
|
1856
1856
|
const otherUrlPathname = otherUrlObject.pathname;
|
|
1857
1857
|
if (urlPathname === otherUrlPathname) {
|
|
1858
|
-
return
|
|
1858
|
+
return true;
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
1861
1861
|
const isInside = urlPathname.startsWith(otherUrlPathname);
|
|
@@ -2038,7 +2038,10 @@ const comparePathnames = (leftPathame, rightPathname) => {
|
|
|
2038
2038
|
const rightPart = rightPartArray[i];
|
|
2039
2039
|
i++;
|
|
2040
2040
|
// local comparison comes first
|
|
2041
|
-
const comparison = leftPart.localeCompare(rightPart
|
|
2041
|
+
const comparison = leftPart.localeCompare(rightPart, undefined, {
|
|
2042
|
+
numeric: true,
|
|
2043
|
+
sensitivity: "base",
|
|
2044
|
+
});
|
|
2042
2045
|
if (comparison !== 0) {
|
|
2043
2046
|
return comparison;
|
|
2044
2047
|
}
|
|
@@ -5549,7 +5552,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
5549
5552
|
exception.stack = replaceUrls$1(
|
|
5550
5553
|
error.stack,
|
|
5551
5554
|
({ match, url, line = 1, column = 1 }) => {
|
|
5552
|
-
if (
|
|
5555
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
5553
5556
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
5554
5557
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
5555
5558
|
}
|
|
@@ -5561,7 +5564,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
5561
5564
|
exception.stack = replaceUrls$1(
|
|
5562
5565
|
error.stack,
|
|
5563
5566
|
({ match, url, line = 1, column = 1 }) => {
|
|
5564
|
-
if (
|
|
5567
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
5565
5568
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
5566
5569
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
5567
5570
|
}
|
|
@@ -8021,7 +8024,7 @@ To fix this warning:
|
|
|
8021
8024
|
for (const { relativeUrl, meta } of fileResultArray) {
|
|
8022
8025
|
if (onlyWithinUrl) {
|
|
8023
8026
|
const fileUrl = new URL(relativeUrl, rootDirectoryUrl).href;
|
|
8024
|
-
if (!
|
|
8027
|
+
if (!urlIsOrIsInsideOf(fileUrl, onlyWithinUrl)) {
|
|
8025
8028
|
continue;
|
|
8026
8029
|
}
|
|
8027
8030
|
}
|
|
@@ -8545,7 +8548,7 @@ const memoize = (compute) => {
|
|
|
8545
8548
|
|
|
8546
8549
|
const WEB_URL_CONVERTER = {
|
|
8547
8550
|
asWebUrl: (fileUrl, webServer) => {
|
|
8548
|
-
if (
|
|
8551
|
+
if (urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
8549
8552
|
return moveUrl({
|
|
8550
8553
|
url: fileUrl,
|
|
8551
8554
|
from: webServer.rootDirectoryUrl,
|
|
@@ -8763,7 +8766,7 @@ const createRuntimeUsingPlaywright = ({
|
|
|
8763
8766
|
coverageFileUrl,
|
|
8764
8767
|
}) => {
|
|
8765
8768
|
const fileUrl = new URL(fileRelativeUrl, rootDirectoryUrl).href;
|
|
8766
|
-
if (!
|
|
8769
|
+
if (!urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
8767
8770
|
throw new Error(`Cannot execute file that is outside web server root directory
|
|
8768
8771
|
--- file ---
|
|
8769
8772
|
${fileUrl}
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "3.7.8",
|
|
5
4
|
"repository": {
|
|
6
5
|
"type": "git",
|
|
7
6
|
"url": "https://github.com/jsenv/core",
|
|
8
7
|
"directory": "packages/related/test"
|
|
9
8
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"sideEffects": [
|
|
11
|
+
"./src/runtime_node/node_child_process_controlled.mjs",
|
|
12
|
+
"./src/runtime_node/node_worker_thread_controlled.mjs",
|
|
13
|
+
"./dist/js/node_child_process_controlled.mjs",
|
|
14
|
+
"./dist/js/node_worker_thread_controlled.mjs",
|
|
15
|
+
"./dist/jsenv_test_node_modules.js",
|
|
16
|
+
"./dist/jsenv_test.js"
|
|
17
|
+
],
|
|
16
18
|
"type": "module",
|
|
17
19
|
"exports": {
|
|
18
20
|
".": {
|
|
@@ -27,27 +29,15 @@
|
|
|
27
29
|
"/dist/",
|
|
28
30
|
"/src/"
|
|
29
31
|
],
|
|
30
|
-
"sideEffects": [
|
|
31
|
-
"./src/runtime_node/node_child_process_controlled.mjs",
|
|
32
|
-
"./src/runtime_node/node_worker_thread_controlled.mjs",
|
|
33
|
-
"./dist/js/node_child_process_controlled.mjs",
|
|
34
|
-
"./dist/js/node_worker_thread_controlled.mjs",
|
|
35
|
-
"./dist/jsenv_test_node_modules.js",
|
|
36
|
-
"./dist/jsenv_test.js"
|
|
37
|
-
],
|
|
38
32
|
"scripts": {
|
|
39
33
|
"build": "node --conditions=dev:jsenv ./scripts/build.mjs",
|
|
40
34
|
"prepublishOnly": "npm run build"
|
|
41
35
|
},
|
|
42
|
-
"optionalDependencies": {
|
|
43
|
-
"playwright": "1.x",
|
|
44
|
-
"playwright-core": "1.x"
|
|
45
|
-
},
|
|
46
36
|
"dependencies": {
|
|
47
37
|
"@c88/v8-coverage": "0.1.1",
|
|
48
|
-
"@jsenv/ast": "6.7.
|
|
49
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
50
|
-
"@jsenv/sourcemap": "1.3.
|
|
38
|
+
"@jsenv/ast": "6.7.7",
|
|
39
|
+
"@jsenv/plugin-supervisor": "1.7.4",
|
|
40
|
+
"@jsenv/sourcemap": "1.3.9",
|
|
51
41
|
"he": "1.2.0",
|
|
52
42
|
"istanbul-lib-coverage": "3.2.2",
|
|
53
43
|
"istanbul-lib-instrument": "6.0.3",
|
|
@@ -57,26 +47,36 @@
|
|
|
57
47
|
"v8-to-istanbul": "9.3.0"
|
|
58
48
|
},
|
|
59
49
|
"devDependencies": {
|
|
50
|
+
"@jsenv/abort": "../../tooling/abort",
|
|
60
51
|
"@jsenv/assert": "../tooling/assert",
|
|
61
|
-
"@jsenv/snapshot": "../tooling/snapshot",
|
|
62
|
-
"@jsenv/terminal-recorder": "../tooling/terminal-recorder",
|
|
63
|
-
"@jsenv/server": "../backend/server",
|
|
64
52
|
"@jsenv/core": "../../",
|
|
65
|
-
"@jsenv/os-metrics": "../../tooling/os-metrics",
|
|
66
|
-
"@jsenv/importmap": "../../tooling/importmap",
|
|
67
|
-
"@jsenv/plugin-explorer": "../plugin-explorer",
|
|
68
|
-
"@jsenv/test": "./",
|
|
69
|
-
"@jsenv/abort": "../../tooling/abort",
|
|
70
53
|
"@jsenv/exception": "../../backend/exception",
|
|
71
54
|
"@jsenv/filesystem": "../../backend/filesystem",
|
|
72
55
|
"@jsenv/github-check-run": "../../tooling/github-check-run",
|
|
56
|
+
"@jsenv/humanize": "../../tooling/humanize",
|
|
57
|
+
"@jsenv/importmap": "../../tooling/importmap",
|
|
73
58
|
"@jsenv/node-esm-resolution": "../../tooling/node-esm-resolution",
|
|
59
|
+
"@jsenv/os-metrics": "../../tooling/os-metrics",
|
|
60
|
+
"@jsenv/plugin-explorer": "../plugin-explorer",
|
|
61
|
+
"@jsenv/server": "../backend/server",
|
|
62
|
+
"@jsenv/snapshot": "../tooling/snapshot",
|
|
63
|
+
"@jsenv/terminal-recorder": "../tooling/terminal-recorder",
|
|
64
|
+
"@jsenv/test": "./",
|
|
74
65
|
"@jsenv/url-meta": "../../tooling/url-meta",
|
|
75
66
|
"@jsenv/urls": "../../tooling/urls",
|
|
76
67
|
"@jsenv/utils": "../../tooling/utils",
|
|
77
|
-
"
|
|
68
|
+
"prettier": "3.5.3",
|
|
78
69
|
"strip-ansi": "7.1.0",
|
|
79
|
-
"supports-color": "10.0.0"
|
|
80
|
-
|
|
70
|
+
"supports-color": "10.0.0"
|
|
71
|
+
},
|
|
72
|
+
"optionalDependencies": {
|
|
73
|
+
"playwright": "1.x",
|
|
74
|
+
"playwright-core": "1.x"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=20.11.0"
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public"
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
startMonitoringMemoryUsage,
|
|
28
28
|
} from "@jsenv/os-metrics";
|
|
29
29
|
import { URL_META } from "@jsenv/url-meta";
|
|
30
|
-
import {
|
|
30
|
+
import { urlIsOrIsInsideOf } from "@jsenv/urls";
|
|
31
31
|
import { existsSync } from "node:fs";
|
|
32
32
|
import { takeCoverage } from "node:v8";
|
|
33
33
|
import stripAnsi from "strip-ansi";
|
|
@@ -683,7 +683,7 @@ To fix this warning:
|
|
|
683
683
|
for (const { relativeUrl, meta } of fileResultArray) {
|
|
684
684
|
if (onlyWithinUrl) {
|
|
685
685
|
const fileUrl = new URL(relativeUrl, rootDirectoryUrl).href;
|
|
686
|
-
if (!
|
|
686
|
+
if (!urlIsOrIsInsideOf(fileUrl, onlyWithinUrl)) {
|
|
687
687
|
continue;
|
|
688
688
|
}
|
|
689
689
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { urlIsOrIsInsideOf, urlToRelativeUrl } from "@jsenv/urls";
|
|
2
2
|
|
|
3
3
|
export const githubAnnotationFromError = (
|
|
4
4
|
error,
|
|
@@ -40,7 +40,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
40
40
|
exception.stack = replaceUrls(
|
|
41
41
|
error.stack,
|
|
42
42
|
({ match, url, line = 1, column = 1 }) => {
|
|
43
|
-
if (
|
|
43
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
44
44
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
45
45
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
46
46
|
}
|
|
@@ -52,7 +52,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
52
52
|
exception.stack = replaceUrls(
|
|
53
53
|
error.stack,
|
|
54
54
|
({ match, url, line = 1, column = 1 }) => {
|
|
55
|
-
if (
|
|
55
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
56
56
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
57
57
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
58
58
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ensureWindowsDriveLetter } from "@jsenv/filesystem";
|
|
2
|
-
import { moveUrl,
|
|
2
|
+
import { moveUrl, urlIsOrIsInsideOf } from "@jsenv/urls";
|
|
3
3
|
|
|
4
4
|
export const WEB_URL_CONVERTER = {
|
|
5
5
|
asWebUrl: (fileUrl, webServer) => {
|
|
6
|
-
if (
|
|
6
|
+
if (urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
7
7
|
return moveUrl({
|
|
8
8
|
url: fileUrl,
|
|
9
9
|
from: webServer.rootDirectoryUrl,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Abort, raceCallbacks } from "@jsenv/abort";
|
|
2
2
|
import { createDetailedMessage } from "@jsenv/humanize";
|
|
3
|
-
import {
|
|
3
|
+
import { urlIsOrIsInsideOf } from "@jsenv/urls";
|
|
4
4
|
import { memoize } from "@jsenv/utils/src/memoize/memoize.js";
|
|
5
5
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { composeTwoFileByFileIstanbulCoverages } from "../coverage/istanbul_coverage_composition.js";
|
|
@@ -57,7 +57,7 @@ export const createRuntimeUsingPlaywright = ({
|
|
|
57
57
|
coverageFileUrl,
|
|
58
58
|
}) => {
|
|
59
59
|
const fileUrl = new URL(fileRelativeUrl, rootDirectoryUrl).href;
|
|
60
|
-
if (!
|
|
60
|
+
if (!urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
61
61
|
throw new Error(`Cannot execute file that is outside web server root directory
|
|
62
62
|
--- file ---
|
|
63
63
|
${fileUrl}
|