@rspack-canary/test-tools 1.6.8-canary-02b3377e-20251215174244 → 1.7.0-canary-a0fc091c-20251217174017
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/case/builtin.js +1 -0
- package/dist/case/cache.js +1 -2
- package/dist/case/config.js +1 -2
- package/dist/case/diagnostic.js +1 -2
- package/dist/case/esm-output.js +4 -0
- package/dist/case/hash.js +1 -2
- package/dist/case/hook.js +1 -2
- package/dist/case/hot.js +1 -2
- package/dist/case/normal.js +1 -1
- package/dist/case/stats-output.js +1 -2
- package/dist/helper/legacy/checkArrayExpectation.js +37 -7
- package/dist/helper/legacy/createFakeWorker.js +19 -1
- package/package.json +2 -2
package/dist/case/builtin.js
CHANGED
package/dist/case/cache.js
CHANGED
package/dist/case/config.js
CHANGED
package/dist/case/diagnostic.js
CHANGED
package/dist/case/esm-output.js
CHANGED
|
@@ -101,6 +101,10 @@ const defaultOptions = (_index, context) => ({
|
|
|
101
101
|
chunkIds: "named",
|
|
102
102
|
runtimeChunk: "single"
|
|
103
103
|
},
|
|
104
|
+
externals: {
|
|
105
|
+
fs: "module-import fs",
|
|
106
|
+
path: "module-import path"
|
|
107
|
+
},
|
|
104
108
|
plugins: [new core_1.default.experiments.EsmLibraryPlugin()],
|
|
105
109
|
experiments: {
|
|
106
110
|
css: true,
|
package/dist/case/hash.js
CHANGED
package/dist/case/hook.js
CHANGED
package/dist/case/hot.js
CHANGED
package/dist/case/normal.js
CHANGED
|
@@ -111,6 +111,7 @@ function defaultOptions(context, compilerOptions, mode) {
|
|
|
111
111
|
providedExports: true,
|
|
112
112
|
usedExports: true,
|
|
113
113
|
mangleExports: true,
|
|
114
|
+
inlineExports: true,
|
|
114
115
|
// CHANGE: rspack does not support `emitOnErrors` yet.
|
|
115
116
|
emitOnErrors: true,
|
|
116
117
|
concatenateModules: !!testConfig?.optimization?.concatenateModules,
|
|
@@ -195,7 +196,6 @@ function defaultOptions(context, compilerOptions, mode) {
|
|
|
195
196
|
},
|
|
196
197
|
asyncWebAssembly: true,
|
|
197
198
|
topLevelAwait: true,
|
|
198
|
-
inlineConst: true,
|
|
199
199
|
// CHANGE: rspack does not support `backCompat` yet.
|
|
200
200
|
// backCompat: false,
|
|
201
201
|
// CHANGE: Rspack enables `css` by default.
|
|
@@ -87,20 +87,50 @@ module.exports = async function checkArrayExpectation(testDirectory, object, kin
|
|
|
87
87
|
done(new Error(`Less ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
|
+
const usedExpected = new Array(expected.length).fill(false);
|
|
90
91
|
for (let i = 0; i < array.length; i++) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
let found = false;
|
|
93
|
+
for (let j = 0; j < expected.length; j++) {
|
|
94
|
+
if (usedExpected[j])
|
|
95
|
+
continue;
|
|
96
|
+
if (Array.isArray(expected[j])) {
|
|
97
|
+
for (let k = 0; k < expected[j].length; k++) {
|
|
98
|
+
if (check(expected[j][k], array[i])) {
|
|
99
|
+
usedExpected[j] = true;
|
|
100
|
+
found = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
96
103
|
}
|
|
97
104
|
}
|
|
105
|
+
else {
|
|
106
|
+
if (check(expected[j], array[i])) {
|
|
107
|
+
usedExpected[j] = true;
|
|
108
|
+
found = true;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (found)
|
|
113
|
+
break;
|
|
98
114
|
}
|
|
99
|
-
|
|
100
|
-
done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match
|
|
115
|
+
if (!found) {
|
|
116
|
+
done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match any expected value`));
|
|
101
117
|
return true;
|
|
102
118
|
}
|
|
103
119
|
}
|
|
120
|
+
const unused = [];
|
|
121
|
+
for (let j = 0; j < expected.length; j++) {
|
|
122
|
+
if (!usedExpected[j]) {
|
|
123
|
+
unused.push(Array.isArray(expected[j])
|
|
124
|
+
? expected[j].map(explain).join(' | ')
|
|
125
|
+
: explain(expected[j]));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (unused.length > 0) {
|
|
129
|
+
done(new Error(`The following expected ${kind}s were not matched:\n${unused
|
|
130
|
+
.map(u => ` ${u}`)
|
|
131
|
+
.join('\n')}`));
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
104
134
|
}
|
|
105
135
|
else if (array.length > 0) {
|
|
106
136
|
done(new Error(`${upperCaseKind}s while compiling:\n\n${array
|
|
@@ -36,6 +36,22 @@ self.importScripts = url => {
|
|
|
36
36
|
: "require(urlToPath(url))"};
|
|
37
37
|
};
|
|
38
38
|
self.fetch = async url => {
|
|
39
|
+
if (typeof url === "string" ? url.endsWith(".wasm") : url.toString().endsWith(".wasm")) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
fs.readFile(require("node:url").fileURLToPath(url), (err, data) => {
|
|
42
|
+
if (err) {
|
|
43
|
+
reject(err);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
return resolve(
|
|
47
|
+
new Response(data, {
|
|
48
|
+
headers: { "Content-Type": "application/wasm" }
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
try {
|
|
40
56
|
const buffer = await new Promise((resolve, reject) =>
|
|
41
57
|
fs.readFile(urlToPath(url), (err, b) =>
|
|
@@ -43,7 +59,9 @@ self.fetch = async url => {
|
|
|
43
59
|
)
|
|
44
60
|
);
|
|
45
61
|
return {
|
|
46
|
-
headers: { get(name) {
|
|
62
|
+
headers: { get(name) {
|
|
63
|
+
if (name.toLowerCase() === "content-type") {}
|
|
64
|
+
} },
|
|
47
65
|
status: 200,
|
|
48
66
|
ok: true,
|
|
49
67
|
arrayBuffer() { return buffer; },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/test-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-canary-a0fc091c-20251217174017",
|
|
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": "npm:@rspack-canary/core@1.
|
|
68
|
+
"@rspack/core": "npm:@rspack-canary/core@1.7.0-canary-a0fc091c-20251217174017"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@rspack/core": ">=1.0.0"
|