@jsenv/test 3.7.6 → 3.7.7
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);
|
|
@@ -5549,7 +5549,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
5549
5549
|
exception.stack = replaceUrls$1(
|
|
5550
5550
|
error.stack,
|
|
5551
5551
|
({ match, url, line = 1, column = 1 }) => {
|
|
5552
|
-
if (
|
|
5552
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
5553
5553
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
5554
5554
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
5555
5555
|
}
|
|
@@ -5561,7 +5561,7 @@ const asException = (error, { rootDirectoryUrl }) => {
|
|
|
5561
5561
|
exception.stack = replaceUrls$1(
|
|
5562
5562
|
error.stack,
|
|
5563
5563
|
({ match, url, line = 1, column = 1 }) => {
|
|
5564
|
-
if (
|
|
5564
|
+
if (urlIsOrIsInsideOf(url, rootDirectoryUrl)) {
|
|
5565
5565
|
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
5566
5566
|
match = stringifyUrlSite({ url: relativeUrl, line, column });
|
|
5567
5567
|
}
|
|
@@ -8021,7 +8021,7 @@ To fix this warning:
|
|
|
8021
8021
|
for (const { relativeUrl, meta } of fileResultArray) {
|
|
8022
8022
|
if (onlyWithinUrl) {
|
|
8023
8023
|
const fileUrl = new URL(relativeUrl, rootDirectoryUrl).href;
|
|
8024
|
-
if (!
|
|
8024
|
+
if (!urlIsOrIsInsideOf(fileUrl, onlyWithinUrl)) {
|
|
8025
8025
|
continue;
|
|
8026
8026
|
}
|
|
8027
8027
|
}
|
|
@@ -8545,7 +8545,7 @@ const memoize = (compute) => {
|
|
|
8545
8545
|
|
|
8546
8546
|
const WEB_URL_CONVERTER = {
|
|
8547
8547
|
asWebUrl: (fileUrl, webServer) => {
|
|
8548
|
-
if (
|
|
8548
|
+
if (urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
8549
8549
|
return moveUrl({
|
|
8550
8550
|
url: fileUrl,
|
|
8551
8551
|
from: webServer.rootDirectoryUrl,
|
|
@@ -8763,7 +8763,7 @@ const createRuntimeUsingPlaywright = ({
|
|
|
8763
8763
|
coverageFileUrl,
|
|
8764
8764
|
}) => {
|
|
8765
8765
|
const fileUrl = new URL(fileRelativeUrl, rootDirectoryUrl).href;
|
|
8766
|
-
if (!
|
|
8766
|
+
if (!urlIsOrIsInsideOf(fileUrl, webServer.rootDirectoryUrl)) {
|
|
8767
8767
|
throw new Error(`Cannot execute file that is outside web server root directory
|
|
8768
8768
|
--- file ---
|
|
8769
8769
|
${fileUrl}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@c88/v8-coverage": "0.1.1",
|
|
48
|
-
"@jsenv/ast": "6.7.
|
|
49
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
50
|
-
"@jsenv/sourcemap": "1.3.
|
|
48
|
+
"@jsenv/ast": "6.7.6",
|
|
49
|
+
"@jsenv/plugin-supervisor": "1.7.3",
|
|
50
|
+
"@jsenv/sourcemap": "1.3.9",
|
|
51
51
|
"he": "1.2.0",
|
|
52
52
|
"istanbul-lib-coverage": "3.2.2",
|
|
53
53
|
"istanbul-lib-instrument": "6.0.3",
|
|
@@ -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}
|