@jsenv/test 3.5.26 → 3.5.28

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.
@@ -1870,13 +1870,27 @@ const urlIsInsideOf = (url, otherUrl) => {
1870
1870
  };
1871
1871
 
1872
1872
  const urlToFileSystemPath = (url) => {
1873
- let urlString = String(url);
1874
- if (urlString[urlString.length - 1] === "/") {
1873
+ const urlObject = new URL(url);
1874
+ let { origin, pathname, hash } = urlObject;
1875
+ if (urlObject.protocol === "file:") {
1876
+ origin = "file://";
1877
+ }
1878
+ pathname = pathname
1879
+ .split("/")
1880
+ .map((part) => {
1881
+ return part.replace(/%(?![0-9A-F][0-9A-F])/g, "%25");
1882
+ })
1883
+ .join("/");
1884
+ if (hash) {
1885
+ pathname += `%23${encodeURIComponent(hash.slice(1))}`;
1886
+ }
1887
+ const urlString = `${origin}${pathname}`;
1888
+ const fileSystemPath = fileURLToPath(urlString);
1889
+ if (fileSystemPath[fileSystemPath.length - 1] === "/") {
1875
1890
  // remove trailing / so that nodejs path becomes predictable otherwise it logs
1876
1891
  // the trailing slash on linux but does not on windows
1877
- urlString = urlString.slice(0, -1);
1892
+ return fileSystemPath.slice(0, -1);
1878
1893
  }
1879
- const fileSystemPath = fileURLToPath(urlString);
1880
1894
  return fileSystemPath;
1881
1895
  };
1882
1896
 
@@ -5618,7 +5632,7 @@ const startServerUsingCommand = async (
5618
5632
  let isTeardown = false;
5619
5633
  let processClosed = false;
5620
5634
  spawnedProcess.stderr.on("data", (data) => {
5621
- logger.error(data);
5635
+ logger.error(String(data));
5622
5636
  });
5623
5637
  const closedPromise = new Promise((resolve) => {
5624
5638
  spawnedProcess.once("exit", (exitCode, signal) => {
@@ -9166,7 +9180,7 @@ const reportCoverageAsHtml = (
9166
9180
  const libReport = importWithRequire("istanbul-lib-report");
9167
9181
  const reports = importWithRequire("istanbul-reports");
9168
9182
  const context = libReport.createContext({
9169
- dir: fileURLToPath(rootDirectoryUrl),
9183
+ dir: urlToFileSystemPath(rootDirectoryUrl),
9170
9184
  coverageMap: istanbulCoverageMapFromCoverage(testPlanCoverage),
9171
9185
  sourceFinder: (path) =>
9172
9186
  readFileSync(new URL(path, rootDirectoryUrl), "utf8"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.5.26",
3
+ "version": "3.5.28",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,16 +37,16 @@
37
37
  "dependencies": {
38
38
  "@c88/v8-coverage": "0.1.1",
39
39
  "@jsenv/abort": "4.3.0",
40
- "@jsenv/ast": "6.3.5",
40
+ "@jsenv/ast": "6.3.7",
41
41
  "@jsenv/exception": "1.1.3",
42
- "@jsenv/filesystem": "4.10.11",
43
- "@jsenv/github-check-run": "0.2.3",
42
+ "@jsenv/filesystem": "4.10.13",
43
+ "@jsenv/github-check-run": "0.2.5",
44
44
  "@jsenv/node-esm-resolution": "1.0.6",
45
45
  "@jsenv/humanize": "1.2.8",
46
- "@jsenv/plugin-supervisor": "1.5.28",
47
- "@jsenv/sourcemap": "1.2.25",
46
+ "@jsenv/plugin-supervisor": "1.5.30",
47
+ "@jsenv/sourcemap": "1.2.27",
48
48
  "@jsenv/url-meta": "8.5.2",
49
- "@jsenv/urls": "2.5.2",
49
+ "@jsenv/urls": "2.5.4",
50
50
  "@jsenv/utils": "2.1.2",
51
51
  "he": "1.2.0",
52
52
  "istanbul-lib-coverage": "3.2.2",
@@ -1,8 +1,6 @@
1
1
  import { ensureEmptyDirectorySync } from "@jsenv/filesystem";
2
- import { urlToRelativeUrl } from "@jsenv/urls";
2
+ import { urlToFileSystemPath, urlToRelativeUrl } from "@jsenv/urls";
3
3
  import { readFileSync } from "node:fs";
4
- import { fileURLToPath } from "node:url";
5
-
6
4
  import { importWithRequire } from "../helpers/import_with_require.js";
7
5
  import { istanbulCoverageMapFromCoverage } from "./istanbul_coverage_map_from_coverage.js";
8
6
 
@@ -29,7 +27,7 @@ export const reportCoverageAsHtml = (
29
27
  const libReport = importWithRequire("istanbul-lib-report");
30
28
  const reports = importWithRequire("istanbul-reports");
31
29
  const context = libReport.createContext({
32
- dir: fileURLToPath(rootDirectoryUrl),
30
+ dir: urlToFileSystemPath(rootDirectoryUrl),
33
31
  coverageMap: istanbulCoverageMapFromCoverage(testPlanCoverage),
34
32
  sourceFinder: (path) =>
35
33
  readFileSync(new URL(path, rootDirectoryUrl), "utf8"),
@@ -43,7 +43,7 @@ export const startServerUsingCommand = async (
43
43
  let isTeardown = false;
44
44
  let processClosed = false;
45
45
  spawnedProcess.stderr.on("data", (data) => {
46
- logger.error(data);
46
+ logger.error(String(data));
47
47
  });
48
48
  const closedPromise = new Promise((resolve) => {
49
49
  spawnedProcess.once("exit", (exitCode, signal) => {
@@ -6,7 +6,6 @@ import { ANSI, UNICODE } from "@jsenv/humanize";
6
6
  import { memoize } from "@jsenv/utils/src/memoize/memoize.js";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { Worker } from "node:worker_threads";
9
-
10
9
  import { createChildExecOptions } from "./child_exec_options.js";
11
10
  import { ExecOptions } from "./exec_options.js";
12
11
  import { EXIT_CODES } from "./exit_codes.js";