@jsenv/test 3.5.39 → 3.5.41

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.
@@ -82,12 +82,18 @@ const applyMatching = (pattern, string) => {
82
82
  }
83
83
  };
84
84
  const matchOne = () => {
85
- // pattern consumed and string consumed
86
- if (remainingPattern === "" && remainingString === "") {
87
- return true; // string fully matched pattern
88
- }
89
- // pattern consumed, string not consumed
90
- if (remainingPattern === "" && remainingString !== "") {
85
+ // pattern consumed
86
+ if (remainingPattern === "") {
87
+ if (remainingString === "") {
88
+ return true; // string fully matched pattern
89
+ }
90
+ if (remainingString[0] === "?") {
91
+ // match search params
92
+ consumeRemainingString();
93
+
94
+ return true;
95
+ }
96
+ // if remainingString
91
97
  return false; // fails because string longer than expect
92
98
  }
93
99
  // -- from this point pattern is not consumed --
@@ -2205,6 +2205,27 @@ const readDirectory = async (url, { emfileMaxWait = 1000 } = {}) => {
2205
2205
  return attempt();
2206
2206
  };
2207
2207
 
2208
+ const generateWindowsEPERMErrorMessage = (
2209
+ error,
2210
+ { operation, path },
2211
+ ) => {
2212
+ const pathLengthIsExceedingUsualLimit = String(path).length >= 256;
2213
+ let message = "";
2214
+
2215
+ if (operation) {
2216
+ message += `error while trying to fix windows EPERM after ${operation} on ${path}`;
2217
+ }
2218
+
2219
+ if (pathLengthIsExceedingUsualLimit) {
2220
+ message += "\n";
2221
+ message += `Maybe because path length is exceeding the usual limit of 256 characters of windows OS?`;
2222
+ message += "\n";
2223
+ }
2224
+ message += "\n";
2225
+ message += error.stack;
2226
+ return message;
2227
+ };
2228
+
2208
2229
  const writeEntryPermissions = async (source, permissions) => {
2209
2230
  const sourceUrl = assertAndNormalizeFileUrl(source);
2210
2231
 
@@ -2275,7 +2296,10 @@ const readEntryStat = async (
2275
2296
  return stats;
2276
2297
  } catch (e) {
2277
2298
  console.error(
2278
- `error while trying to fix windows EPERM after stats on ${sourcePath}: ${e.stack}`,
2299
+ generateWindowsEPERMErrorMessage(e, {
2300
+ operation: "stats",
2301
+ path: sourcePath,
2302
+ }),
2279
2303
  );
2280
2304
  throw error;
2281
2305
  }
@@ -2467,7 +2491,10 @@ const readEntryStatSync = (
2467
2491
  return stats;
2468
2492
  } catch (e) {
2469
2493
  console.error(
2470
- `error while trying to fix windows EPERM after stats on ${sourcePath}: ${e.stack}`,
2494
+ generateWindowsEPERMErrorMessage(e, {
2495
+ operation: "stats",
2496
+ path: sourcePath,
2497
+ }),
2471
2498
  );
2472
2499
  throw error;
2473
2500
  }
@@ -2724,7 +2751,10 @@ const removeDirectorySync$1 = (
2724
2751
  return;
2725
2752
  }
2726
2753
  console.error(
2727
- `error while trying to fix windows EPERM after readir on ${directoryPath}: ${openOrCloseError.stack}`,
2754
+ generateWindowsEPERMErrorMessage(openOrCloseError, {
2755
+ path: directoryPath,
2756
+ operation: "readir",
2757
+ }),
2728
2758
  );
2729
2759
  throw error;
2730
2760
  }
@@ -3060,7 +3090,6 @@ const removeDirectory = async (
3060
3090
  console.error(
3061
3091
  `trying to fix windows EPERM after readir on ${directoryPath}`,
3062
3092
  );
3063
-
3064
3093
  let openOrCloseError;
3065
3094
  try {
3066
3095
  const fd = openSync(directoryPath);
@@ -3074,7 +3103,10 @@ const removeDirectory = async (
3074
3103
  return;
3075
3104
  }
3076
3105
  console.error(
3077
- `error while trying to fix windows EPERM after readir on ${directoryPath}: ${openOrCloseError.stack}`,
3106
+ generateWindowsEPERMErrorMessage(openOrCloseError, {
3107
+ operation: "readdir",
3108
+ path: directoryPath,
3109
+ }),
3078
3110
  );
3079
3111
  throw error;
3080
3112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.5.39",
3
+ "version": "3.5.41",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,14 +38,14 @@
38
38
  "@c88/v8-coverage": "0.1.1",
39
39
  "@jsenv/abort": "4.3.0",
40
40
  "@jsenv/ast": "6.5.0",
41
- "@jsenv/exception": "1.1.3",
42
- "@jsenv/filesystem": "4.13.2",
43
- "@jsenv/github-check-run": "0.2.9",
41
+ "@jsenv/exception": "1.1.4",
42
+ "@jsenv/filesystem": "4.13.4",
43
+ "@jsenv/github-check-run": "0.2.10",
44
44
  "@jsenv/node-esm-resolution": "1.0.6",
45
45
  "@jsenv/humanize": "1.2.8",
46
46
  "@jsenv/plugin-supervisor": "1.6.4",
47
47
  "@jsenv/sourcemap": "1.2.30",
48
- "@jsenv/url-meta": "8.5.2",
48
+ "@jsenv/url-meta": "8.5.3",
49
49
  "@jsenv/urls": "2.6.0",
50
50
  "@jsenv/utils": "2.1.2",
51
51
  "he": "1.2.0",