@jsenv/test 3.5.25 → 3.5.27

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,21 @@ 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 urlString;
1875
+ if (urlObject.hash) {
1876
+ const origin =
1877
+ urlObject.protocol === "file:" ? "file://" : urlObject.origin;
1878
+ urlString = `${origin}${urlObject.pathname}${urlObject.search}%23${urlObject.hash.slice(1)}`;
1879
+ } else {
1880
+ urlString = urlObject.href;
1881
+ }
1882
+ const fileSystemPath = fileURLToPath(urlString);
1883
+ if (fileSystemPath[fileSystemPath.length - 1] === "/") {
1875
1884
  // remove trailing / so that nodejs path becomes predictable otherwise it logs
1876
1885
  // the trailing slash on linux but does not on windows
1877
- urlString = urlString.slice(0, -1);
1886
+ return fileSystemPath.slice(0, -1);
1878
1887
  }
1879
- const fileSystemPath = fileURLToPath(urlString);
1880
1888
  return fileSystemPath;
1881
1889
  };
1882
1890
 
@@ -5618,7 +5626,7 @@ const startServerUsingCommand = async (
5618
5626
  let isTeardown = false;
5619
5627
  let processClosed = false;
5620
5628
  spawnedProcess.stderr.on("data", (data) => {
5621
- logger.error(data);
5629
+ logger.error(String(data));
5622
5630
  });
5623
5631
  const closedPromise = new Promise((resolve) => {
5624
5632
  spawnedProcess.once("exit", (exitCode, signal) => {
@@ -9166,7 +9174,7 @@ const reportCoverageAsHtml = (
9166
9174
  const libReport = importWithRequire("istanbul-lib-report");
9167
9175
  const reports = importWithRequire("istanbul-reports");
9168
9176
  const context = libReport.createContext({
9169
- dir: fileURLToPath(rootDirectoryUrl),
9177
+ dir: urlToFileSystemPath(rootDirectoryUrl),
9170
9178
  coverageMap: istanbulCoverageMapFromCoverage(testPlanCoverage),
9171
9179
  sourceFinder: (path) =>
9172
9180
  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.25",
3
+ "version": "3.5.27",
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.6",
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.12",
43
+ "@jsenv/github-check-run": "0.2.4",
44
44
  "@jsenv/node-esm-resolution": "1.0.6",
45
45
  "@jsenv/humanize": "1.2.8",
46
- "@jsenv/plugin-supervisor": "1.5.27",
47
- "@jsenv/sourcemap": "1.2.25",
46
+ "@jsenv/plugin-supervisor": "1.5.29",
47
+ "@jsenv/sourcemap": "1.2.26",
48
48
  "@jsenv/url-meta": "8.5.2",
49
- "@jsenv/urls": "2.5.2",
49
+ "@jsenv/urls": "2.5.3",
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";