@rspack/test-tools 1.6.2 → 1.6.4

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.
@@ -21,6 +21,7 @@ function describeByWalk(testFile, createCase, options = {}) {
21
21
  .replace(/\.(diff|hot)?test\.(j|t)s/, "");
22
22
  const testId = testBasename.charAt(0).toLowerCase() + testBasename.slice(1);
23
23
  const sourceBase = options.source || node_path_1.default.join(node_path_1.default.dirname(testFile), `${testId}Cases`);
24
+ const testSourceId = node_path_1.default.basename(sourceBase);
24
25
  const distBase = options.dist || node_path_1.default.join(node_path_1.default.dirname(testFile), "js", testId);
25
26
  const level = options.level || 2;
26
27
  const type = options.type || "directory";
@@ -54,7 +55,10 @@ function describeByWalk(testFile, createCase, options = {}) {
54
55
  describeDirectory(caseName, currentLevel - 1);
55
56
  }
56
57
  else {
57
- const name = (0, _1.escapeSep)(node_path_1.default.join(`${testId}Cases`, caseName).split(".").shift());
58
+ const name = (0, _1.escapeSep)(node_path_1.default
59
+ .join(`${testId}Cases-${testSourceId}`, caseName)
60
+ .split(".")
61
+ .shift());
58
62
  describeFn(name, () => {
59
63
  const source = node_path_1.default.join(sourceBase, caseName);
60
64
  let dist = "";
@@ -0,0 +1 @@
1
+ export declare function disableIconvLiteWarning(): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.disableIconvLiteWarning = disableIconvLiteWarning;
4
+ function disableIconvLiteWarning() {
5
+ for (const [path, mod] of Object.entries(require.cache)) {
6
+ if (path.includes("iconv-lite") &&
7
+ typeof mod?.exports === "object" &&
8
+ typeof mod.exports.decode === "function") {
9
+ mod.exports.skipDecodeWarning = true;
10
+ }
11
+ }
12
+ }
@@ -89,10 +89,19 @@ if (process.env.DEBUG_INFO) {
89
89
  // eslint-disable-next-line no-global-assign
90
90
  it = addDebugInfo(it);
91
91
  }
92
+ const uncaughtExceptionListenersLength = process.listeners("uncaughtException").length;
93
+ const unhandledRejectionListenersLength = process.listeners("unhandledRejection").length;
92
94
  // cspell:word wabt
93
95
  // Workaround for a memory leak in wabt
94
96
  // It leaks an Error object on construction
95
97
  // so it leaks the whole stack trace
96
98
  require("wast-loader");
97
- process.removeAllListeners("uncaughtException");
98
- process.removeAllListeners("unhandledRejection");
99
+ // remove the last uncaughtException / unhandledRejection listener added by wast-loader
100
+ const listeners = process.listeners("uncaughtException");
101
+ if (listeners.length > uncaughtExceptionListenersLength) {
102
+ process.off("uncaughtException", listeners[listeners.length - 1]);
103
+ }
104
+ const listeners1 = process.listeners("unhandledRejection");
105
+ if (listeners1.length > unhandledRejectionListenersLength) {
106
+ process.off("unhandledRejection", listeners1[listeners1.length - 1]);
107
+ }
package/dist/index.js CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("./test/context"), exports);
22
22
  __exportStar(require("./test/creator"), exports);
23
23
  __exportStar(require("./test/tester"), exports);
24
24
  __exportStar(require("./type"), exports);
25
+ require("./helper/disable-iconv-lite-warning").disableIconvLiteWarning();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "@types/jsdom": "^21.1.7",
66
66
  "typescript": "^5.9.3",
67
67
  "wast-loader": "^1.14.1",
68
- "@rspack/core": "1.6.2"
68
+ "@rspack/core": "1.6.4"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@rspack/core": ">=1.0.0"