@rspack/test-tools 2.0.2 → 2.0.3
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 +106 -66
- package/dist/case/cache.js +136 -122
- package/dist/case/common.d.ts +4 -4
- package/dist/case/common.js +162 -157
- package/dist/case/compiler.d.ts +4 -4
- package/dist/case/compiler.js +75 -64
- package/dist/case/config.js +112 -74
- package/dist/case/defaults.js +136 -83
- package/dist/case/diagnostic.js +112 -84
- package/dist/case/error.d.ts +4 -4
- package/dist/case/error.js +105 -89
- package/dist/case/esm-output.js +118 -87
- package/dist/case/example.js +73 -35
- package/dist/case/hash.js +74 -59
- package/dist/case/hook.js +151 -138
- package/dist/case/hot-step.js +130 -161
- package/dist/case/hot.js +148 -134
- package/dist/case/incremental.js +91 -58
- package/dist/case/index.js +134 -51
- package/dist/case/multi-compiler.d.ts +4 -4
- package/dist/case/multi-compiler.js +81 -56
- package/dist/case/native-watcher.js +62 -30
- package/dist/case/normal.js +253 -185
- package/dist/case/runner.js +80 -51
- package/dist/case/serial.js +47 -16
- package/dist/case/stats-api.d.ts +4 -4
- package/dist/case/stats-api.js +63 -43
- package/dist/case/stats-output.d.ts +3 -3
- package/dist/case/stats-output.js +147 -152
- package/dist/case/treeshaking.js +66 -35
- package/dist/case/watch.d.ts +3 -19
- package/dist/case/watch.js +204 -224
- package/dist/compiler.js +222 -195
- package/dist/helper/directory.js +83 -71
- package/dist/helper/disable-iconv-lite-warning.js +35 -9
- package/dist/helper/expect/diff.js +39 -10
- package/dist/helper/expect/error.js +62 -30
- package/dist/helper/expect/placeholder.js +47 -21
- package/dist/helper/expect/rspack.js +35 -13
- package/dist/helper/expect/to-be-typeof.js +39 -7
- package/dist/helper/expect/to-end-with.js +40 -8
- package/dist/helper/expect/to-match-file-snapshot.js +103 -80
- package/dist/helper/hot-update/index.js +35 -4
- package/dist/helper/hot-update/loader.d.ts +1 -0
- package/dist/helper/hot-update/loader.js +39 -4
- package/dist/helper/hot-update/plugin.d.ts +1 -1
- package/dist/helper/hot-update/plugin.js +87 -74
- package/dist/helper/index.js +138 -24
- package/dist/helper/is.js +51 -10
- package/dist/helper/legacy/EventSourceForNode.d.ts +11 -3
- package/dist/helper/legacy/EventSourceForNode.js +83 -37
- package/dist/helper/legacy/LogTestPlugin.d.ts +2 -3
- package/dist/helper/legacy/LogTestPlugin.js +39 -6
- package/dist/helper/legacy/asModule.d.ts +3 -3
- package/dist/helper/legacy/asModule.js +68 -19
- package/dist/helper/legacy/captureStdio.d.ts +1 -2
- package/dist/helper/legacy/captureStdio.js +69 -29
- package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -2
- package/dist/helper/legacy/checkArrayExpectation.js +132 -121
- package/dist/helper/legacy/copyDiff.d.ts +1 -2
- package/dist/helper/legacy/copyDiff.js +86 -42
- package/dist/helper/legacy/createFakeWorker.d.ts +2 -3
- package/dist/helper/legacy/createFakeWorker.js +90 -47
- package/dist/helper/legacy/createLazyTestEnv.d.ts +2 -3
- package/dist/helper/legacy/createLazyTestEnv.js +70 -59
- package/dist/helper/legacy/currentScript.d.ts +2 -2
- package/dist/helper/legacy/currentScript.js +35 -2
- package/dist/helper/legacy/deprecationTracking.d.ts +1 -1
- package/dist/helper/legacy/deprecationTracking.js +53 -28
- package/dist/helper/legacy/expectSource.d.ts +3 -2
- package/dist/helper/legacy/expectSource.js +42 -18
- package/dist/helper/legacy/fakeSystem.d.ts +12 -9
- package/dist/helper/legacy/fakeSystem.js +68 -58
- package/dist/helper/legacy/findOutputFiles.d.ts +7 -2
- package/dist/helper/legacy/findOutputFiles.js +60 -13
- package/dist/helper/legacy/parseResource.d.ts +1 -1
- package/dist/helper/legacy/parseResource.js +36 -6
- package/dist/helper/legacy/regexEscape.d.ts +1 -2
- package/dist/helper/legacy/regexEscape.js +39 -5
- package/dist/helper/legacy/supportDefaultAssignment.d.ts +1 -2
- package/dist/helper/legacy/supportDefaultAssignment.js +40 -7
- package/dist/helper/legacy/supportsTextDecoder.d.ts +1 -2
- package/dist/helper/legacy/supportsTextDecoder.js +40 -6
- package/dist/helper/legacy/supportsUsing.d.ts +1 -2
- package/dist/helper/legacy/supportsUsing.js +40 -7
- package/dist/helper/legacy/urlToRelativePath.d.ts +2 -2
- package/dist/helper/legacy/urlToRelativePath.js +56 -7
- package/dist/helper/parse-modules.js +52 -42
- package/dist/helper/read-config-file.js +60 -18
- package/dist/helper/serializers.js +62 -33
- package/dist/helper/setup-env.js +81 -91
- package/dist/helper/setup-expect.js +13 -13
- package/dist/helper/setup-wasm.js +18 -9
- package/dist/helper/stringify-config.js +44 -26
- package/dist/helper/update-snapshot.js +35 -3
- package/dist/helper/util/checkSourceMap.js +119 -80
- package/dist/helper/util/checkStats.d.ts +1 -1
- package/dist/helper/util/checkStats.js +42 -17
- package/dist/helper/util/expectWarningFactory.d.ts +1 -2
- package/dist/helper/util/expectWarningFactory.js +41 -8
- package/dist/helper/util/filterUtil.d.ts +9 -8
- package/dist/helper/util/filterUtil.js +63 -23
- package/dist/helper/win.js +46 -7
- package/dist/index.js +115 -23
- package/dist/plugin/index.js +55 -14
- package/dist/plugin/lazy-compilation-test-plugin.js +55 -41
- package/dist/reporter/index.js +55 -14
- package/dist/reporter/streamed-events-reporter.js +51 -77
- package/dist/runner/index.js +62 -15
- package/dist/runner/node/index.js +365 -431
- package/dist/runner/web/index.js +278 -263
- package/dist/test/context.js +67 -41
- package/dist/test/creator.js +135 -167
- package/dist/test/debug.js +89 -58
- package/dist/test/tester.js +94 -74
- package/dist/type.d.ts +10 -9
- package/dist/type.js +43 -9
- package/package.json +21 -20
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export = _exports;
|
|
1
|
+
export declare function checkArrayExpectation(testDirectory: any, object: any, kind: any, filename: any, upperCaseKind: any, options: any, done: any): Promise<true | undefined>;
|
|
@@ -1,144 +1,155 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
"fs-extra" (module) {
|
|
5
|
+
module.exports = require("fs-extra");
|
|
6
|
+
},
|
|
7
|
+
"node:path" (module) {
|
|
8
|
+
module.exports = require("node:path");
|
|
8
9
|
}
|
|
9
|
-
if (Array.isArray(expected)) {
|
|
10
|
-
return expected.every((e) => check(e, actual));
|
|
11
|
-
}
|
|
12
|
-
return Object.keys(expected).every((key) => {
|
|
13
|
-
let value = actual[key];
|
|
14
|
-
if (typeof value === 'object') {
|
|
15
|
-
value = JSON.stringify(value);
|
|
16
|
-
}
|
|
17
|
-
return expected[key].test(value);
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
const explain = (object) => {
|
|
21
|
-
if (object instanceof RegExp) {
|
|
22
|
-
object = { message: object };
|
|
23
|
-
}
|
|
24
|
-
return Object.keys(object)
|
|
25
|
-
.map((key) => {
|
|
26
|
-
let value = object[key];
|
|
27
|
-
if (typeof value === 'object' && !(value instanceof RegExp)) {
|
|
28
|
-
value = JSON.stringify(value);
|
|
29
|
-
}
|
|
30
|
-
let msg = `${key} = ${value}`;
|
|
31
|
-
if (key !== 'stack' && key !== 'details' && msg.length > 600)
|
|
32
|
-
msg = msg.slice(0, 597) + '...';
|
|
33
|
-
return msg;
|
|
34
|
-
})
|
|
35
|
-
.join('; ');
|
|
36
10
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
11
|
+
var __webpack_module_cache__ = {};
|
|
12
|
+
function __webpack_require__(moduleId) {
|
|
13
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
14
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
15
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
16
|
+
exports: {}
|
|
17
|
+
};
|
|
18
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
19
|
+
return module.exports;
|
|
20
|
+
}
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
23
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: definition[key]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
31
|
+
})();
|
|
32
|
+
(()=>{
|
|
33
|
+
__webpack_require__.r = (exports1)=>{
|
|
34
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
35
|
+
value: 'Module'
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __webpack_exports__ = {};
|
|
43
|
+
(()=>{
|
|
44
|
+
__webpack_require__.r(__webpack_exports__);
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
checkArrayExpectation: ()=>checkArrayExpectation
|
|
47
|
+
});
|
|
48
|
+
const fs = __webpack_require__("fs-extra");
|
|
49
|
+
const path = __webpack_require__("node:path");
|
|
50
|
+
const check = (expected, actual)=>{
|
|
51
|
+
if (expected instanceof RegExp) expected = {
|
|
52
|
+
message: expected
|
|
53
|
+
};
|
|
54
|
+
if (Array.isArray(expected)) return expected.every((e)=>check(e, actual));
|
|
55
|
+
return Object.keys(expected).every((key)=>{
|
|
56
|
+
let value = actual[key];
|
|
57
|
+
if ('object' == typeof value) value = JSON.stringify(value);
|
|
58
|
+
return expected[key].test(value);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const explain = (object)=>{
|
|
62
|
+
if (object instanceof RegExp) object = {
|
|
63
|
+
message: object
|
|
64
|
+
};
|
|
65
|
+
return Object.keys(object).map((key)=>{
|
|
66
|
+
let value = object[key];
|
|
67
|
+
if ('object' == typeof value && !(value instanceof RegExp)) value = JSON.stringify(value);
|
|
68
|
+
let msg = `${key} = ${value}`;
|
|
69
|
+
if ('stack' !== key && 'details' !== key && msg.length > 600) msg = msg.slice(0, 597) + '...';
|
|
70
|
+
return msg;
|
|
71
|
+
}).join('; ');
|
|
72
|
+
};
|
|
73
|
+
const diffItems = (actual, expected, kind)=>{
|
|
74
|
+
const tooMuch = actual.slice();
|
|
75
|
+
const missing = expected.slice();
|
|
76
|
+
for(let i = 0; i < missing.length; i++){
|
|
77
|
+
const current = missing[i];
|
|
78
|
+
for(let j = 0; j < tooMuch.length; j++)if (check(current, tooMuch[j])) {
|
|
44
79
|
tooMuch.splice(j, 1);
|
|
45
80
|
missing.splice(i, 1);
|
|
46
81
|
i--;
|
|
47
82
|
break;
|
|
48
83
|
}
|
|
49
84
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
diff.push(`The following
|
|
54
|
-
${
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
done(new Error(`More ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
if (expected.length > array.length) {
|
|
90
|
-
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}`));
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
const usedExpected = new Array(expected.length).fill(false);
|
|
94
|
-
for (let i = 0; i < array.length; i++) {
|
|
95
|
-
let found = false;
|
|
96
|
-
for (let j = 0; j < expected.length; j++) {
|
|
97
|
-
if (usedExpected[j])
|
|
98
|
-
continue;
|
|
99
|
-
if (Array.isArray(expected[j])) {
|
|
100
|
-
for (let k = 0; k < expected[j].length; k++) {
|
|
101
|
-
if (check(expected[j][k], array[i])) {
|
|
85
|
+
const diff = [];
|
|
86
|
+
if (missing.length > 0) diff.push(`The following expected ${kind}s are missing:
|
|
87
|
+
${missing.map((item)=>`${explain(item)}`).join('\n\n')}`);
|
|
88
|
+
if (tooMuch.length > 0) diff.push(`The following ${kind}s are unexpected:
|
|
89
|
+
${tooMuch.map((item)=>`${explain(item)}`).join('\n\n')}`);
|
|
90
|
+
return diff.join('\n\n');
|
|
91
|
+
};
|
|
92
|
+
async function checkArrayExpectation(testDirectory, object, kind, filename, upperCaseKind, options, done) {
|
|
93
|
+
done = 'function' == typeof done ? done : (error)=>{
|
|
94
|
+
throw error;
|
|
95
|
+
};
|
|
96
|
+
let array = object[`${kind}s`];
|
|
97
|
+
if (Array.isArray(array) && 'warning' === kind) array = array.filter((item)=>!/from Terser/.test(item));
|
|
98
|
+
if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) {
|
|
99
|
+
if (fs.existsSync(path.join(testDirectory, `${filename}-sort.js`))) {
|
|
100
|
+
const sorter = require(path.join(testDirectory, `${filename}-sort.js`));
|
|
101
|
+
array = sorter(array);
|
|
102
|
+
}
|
|
103
|
+
const expectedFilename = path.join(testDirectory, `${filename}.js`);
|
|
104
|
+
let expected = require(expectedFilename);
|
|
105
|
+
if ('function' == typeof expected) expected = expected(options);
|
|
106
|
+
const diff = diffItems(array, expected, kind);
|
|
107
|
+
if (expected.length < array.length) {
|
|
108
|
+
done(new Error(`More ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
if (expected.length > array.length) {
|
|
112
|
+
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}`));
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
const usedExpected = new Array(expected.length).fill(false);
|
|
116
|
+
for(let i = 0; i < array.length; i++){
|
|
117
|
+
let found = false;
|
|
118
|
+
for(let j = 0; j < expected.length; j++)if (!usedExpected[j]) {
|
|
119
|
+
if (Array.isArray(expected[j])) {
|
|
120
|
+
for(let k = 0; k < expected[j].length; k++)if (check(expected[j][k], array[i])) {
|
|
102
121
|
usedExpected[j] = true;
|
|
103
122
|
found = true;
|
|
104
123
|
break;
|
|
105
124
|
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
if (check(expected[j], array[i])) {
|
|
125
|
+
} else if (check(expected[j], array[i])) {
|
|
110
126
|
usedExpected[j] = true;
|
|
111
127
|
found = true;
|
|
112
128
|
break;
|
|
113
129
|
}
|
|
130
|
+
if (found) break;
|
|
131
|
+
}
|
|
132
|
+
if (!found) {
|
|
133
|
+
done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match any expected value`));
|
|
134
|
+
return true;
|
|
114
135
|
}
|
|
115
|
-
if (found)
|
|
116
|
-
break;
|
|
117
136
|
}
|
|
118
|
-
|
|
119
|
-
|
|
137
|
+
const unused = [];
|
|
138
|
+
for(let j = 0; j < expected.length; j++)if (!usedExpected[j]) unused.push(Array.isArray(expected[j]) ? expected[j].map(explain).join(' | ') : explain(expected[j]));
|
|
139
|
+
if (unused.length > 0) {
|
|
140
|
+
done(new Error(`The following expected ${kind}s were not matched:\n${unused.map((u)=>` ${u}`).join('\n')}`));
|
|
120
141
|
return true;
|
|
121
142
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
for (let j = 0; j < expected.length; j++) {
|
|
125
|
-
if (!usedExpected[j]) {
|
|
126
|
-
unused.push(Array.isArray(expected[j])
|
|
127
|
-
? expected[j].map(explain).join(' | ')
|
|
128
|
-
: explain(expected[j]));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (unused.length > 0) {
|
|
132
|
-
done(new Error(`The following expected ${kind}s were not matched:\n${unused
|
|
133
|
-
.map((u) => ` ${u}`)
|
|
134
|
-
.join('\n')}`));
|
|
143
|
+
} else if (array.length > 0) {
|
|
144
|
+
done(new Error(`${upperCaseKind}s while compiling:\n\n${array.map(explain).join('\n\n')}`));
|
|
135
145
|
return true;
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
})();
|
|
149
|
+
exports.checkArrayExpectation = __webpack_exports__.checkArrayExpectation;
|
|
150
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
151
|
+
"checkArrayExpectation"
|
|
152
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
153
|
+
Object.defineProperty(exports, '__esModule', {
|
|
154
|
+
value: true
|
|
155
|
+
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export = _exports;
|
|
1
|
+
export declare function copyDiff(src: any, dest: any, initial: any): void;
|
|
@@ -1,49 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"node:fs" (module) {
|
|
4
|
+
module.exports = require("node:fs");
|
|
5
|
+
},
|
|
6
|
+
"node:path" (module) {
|
|
7
|
+
module.exports = require("node:path");
|
|
8
|
+
},
|
|
9
|
+
rimraf (module) {
|
|
10
|
+
module.exports = require("rimraf");
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var __webpack_module_cache__ = {};
|
|
14
|
+
function __webpack_require__(moduleId) {
|
|
15
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
16
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
17
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
18
|
+
exports: {}
|
|
19
|
+
};
|
|
20
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
21
|
+
return module.exports;
|
|
22
|
+
}
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
25
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: definition[key]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
31
|
+
(()=>{
|
|
32
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
33
|
+
})();
|
|
34
|
+
(()=>{
|
|
35
|
+
__webpack_require__.r = (exports1)=>{
|
|
36
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
37
|
+
value: 'Module'
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
40
|
+
value: true
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
var __webpack_exports__ = {};
|
|
45
|
+
(()=>{
|
|
46
|
+
__webpack_require__.r(__webpack_exports__);
|
|
47
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
48
|
+
copyDiff: ()=>copyDiff
|
|
49
|
+
});
|
|
50
|
+
const fs = __webpack_require__("node:fs");
|
|
51
|
+
const path = __webpack_require__("node:path");
|
|
52
|
+
const { rimrafSync } = __webpack_require__("rimraf");
|
|
53
|
+
function copyDiff(src, dest, initial) {
|
|
54
|
+
fs.mkdirSync(dest, {
|
|
55
|
+
recursive: true
|
|
56
|
+
});
|
|
57
|
+
const files = fs.readdirSync(src);
|
|
58
|
+
for (const filename of files){
|
|
59
|
+
const srcFile = path.join(src, filename);
|
|
60
|
+
const destFile = path.join(dest, filename);
|
|
61
|
+
const stats = fs.lstatSync(srcFile);
|
|
62
|
+
if (stats.isSymbolicLink()) {
|
|
63
|
+
const linkTarget = fs.readlinkSync(srcFile);
|
|
64
|
+
if (fs.existsSync(destFile)) {
|
|
65
|
+
const destStats = fs.lstatSync(destFile);
|
|
66
|
+
if (destStats.isSymbolicLink()) fs.unlinkSync(destFile);
|
|
67
|
+
else if (destStats.isDirectory()) rimrafSync(destFile);
|
|
68
|
+
else fs.unlinkSync(destFile);
|
|
25
69
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
else if (stats.isDirectory()) {
|
|
30
|
-
copyDiff(srcFile, destFile, initial);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const content = fs.readFileSync(srcFile);
|
|
34
|
-
if (/^DELETE\s*$/.test(content.toString('utf-8'))) {
|
|
35
|
-
fs.unlinkSync(destFile);
|
|
36
|
-
}
|
|
37
|
-
else if (/^DELETE_DIRECTORY\s*$/.test(content.toString('utf-8'))) {
|
|
38
|
-
rimrafSync(destFile);
|
|
39
|
-
}
|
|
70
|
+
fs.symlinkSync(linkTarget, destFile);
|
|
71
|
+
} else if (stats.isDirectory()) copyDiff(srcFile, destFile, initial);
|
|
40
72
|
else {
|
|
41
|
-
fs.
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
73
|
+
const content = fs.readFileSync(srcFile);
|
|
74
|
+
if (/^DELETE\s*$/.test(content.toString('utf-8'))) fs.unlinkSync(destFile);
|
|
75
|
+
else if (/^DELETE_DIRECTORY\s*$/.test(content.toString('utf-8'))) rimrafSync(destFile);
|
|
76
|
+
else {
|
|
77
|
+
fs.writeFileSync(destFile, content);
|
|
78
|
+
if (initial) {
|
|
79
|
+
const longTimeAgo = Date.now() - 86400000;
|
|
80
|
+
fs.utimesSync(destFile, Date.now() - longTimeAgo, Date.now() - longTimeAgo);
|
|
81
|
+
}
|
|
45
82
|
}
|
|
46
83
|
}
|
|
47
84
|
}
|
|
48
85
|
}
|
|
49
|
-
};
|
|
86
|
+
})();
|
|
87
|
+
exports.copyDiff = __webpack_exports__.copyDiff;
|
|
88
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
89
|
+
"copyDiff"
|
|
90
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
91
|
+
Object.defineProperty(exports, '__esModule', {
|
|
92
|
+
value: true
|
|
93
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare
|
|
1
|
+
export declare const createFakeWorker: (env: any, { outputDirectory }: {
|
|
2
2
|
outputDirectory: any;
|
|
3
|
-
})
|
|
3
|
+
}) => {
|
|
4
4
|
new (resource: any, options?: {}): {
|
|
5
5
|
url: any;
|
|
6
6
|
worker: import("worker_threads").Worker;
|
|
@@ -10,4 +10,3 @@ declare function _exports(env: any, { outputDirectory }: {
|
|
|
10
10
|
terminate(): Promise<number>;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export = _exports;
|
|
@@ -1,39 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
path (module) {
|
|
5
|
+
module.exports = require("path");
|
|
6
|
+
},
|
|
7
|
+
worker_threads (module) {
|
|
8
|
+
module.exports = require("worker_threads");
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var __webpack_module_cache__ = {};
|
|
12
|
+
function __webpack_require__(moduleId) {
|
|
13
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
14
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
15
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
16
|
+
exports: {}
|
|
17
|
+
};
|
|
18
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
19
|
+
return module.exports;
|
|
20
|
+
}
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
23
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: definition[key]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
31
|
+
})();
|
|
32
|
+
(()=>{
|
|
33
|
+
__webpack_require__.r = (exports1)=>{
|
|
34
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
35
|
+
value: 'Module'
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __webpack_exports__ = {};
|
|
43
|
+
(()=>{
|
|
44
|
+
__webpack_require__.r(__webpack_exports__);
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
createFakeWorker: ()=>createFakeWorker
|
|
47
|
+
});
|
|
48
|
+
const path = __webpack_require__("path");
|
|
49
|
+
const createFakeWorker = (env, { outputDirectory })=>class {
|
|
50
|
+
constructor(resource, options = {}){
|
|
51
|
+
const isFileURL = /^file:/i.test(resource);
|
|
52
|
+
const isBlobURL = /^blob:/i.test(resource);
|
|
53
|
+
if (!isFileURL && !isBlobURL) {
|
|
54
|
+
env.expect(resource.origin).toBe('https://test.cases');
|
|
55
|
+
env.expect(resource.pathname.startsWith('/path/')).toBe(true);
|
|
56
|
+
}
|
|
57
|
+
this.url = resource;
|
|
58
|
+
const file = isFileURL ? resource : path.resolve(outputDirectory, isBlobURL ? options.originalURL.pathname.slice(6) : resource.pathname.slice(6));
|
|
59
|
+
const workerBootstrap = `
|
|
19
60
|
const { parentPort } = require("worker_threads");
|
|
20
61
|
const { URL, fileURLToPath } = require("url");
|
|
21
62
|
const path = require("path");
|
|
22
63
|
const fs = require("fs");
|
|
23
64
|
global.self = global;
|
|
24
65
|
self.URL = URL;
|
|
25
|
-
self.location = new URL(${JSON.stringify(isBlobURL
|
|
26
|
-
? resource.toString().replace('nodedata:', 'https://test.cases/path/')
|
|
27
|
-
: resource.toString())});
|
|
66
|
+
self.location = new URL(${JSON.stringify(isBlobURL ? resource.toString().replace('nodedata:', 'https://test.cases/path/') : resource.toString())});
|
|
28
67
|
const urlToPath = url => {
|
|
29
68
|
if (/^file:/i.test(url)) return fileURLToPath(url);
|
|
30
69
|
if (url.startsWith("https://test.cases/path/")) url = url.slice(24);
|
|
31
70
|
return path.resolve(${JSON.stringify(outputDirectory)}, \`./\${url}\`);
|
|
32
71
|
};
|
|
33
72
|
self.importScripts = url => {
|
|
34
|
-
${options.type
|
|
35
|
-
? 'throw new Error("importScripts is not supported in module workers")'
|
|
36
|
-
: 'require(urlToPath(url))'};
|
|
73
|
+
${'module' === options.type ? 'throw new Error("importScripts is not supported in module workers")' : 'require(urlToPath(url))'};
|
|
37
74
|
};
|
|
38
75
|
self.fetch = async url => {
|
|
39
76
|
if (typeof url === "string" ? url.endsWith(".wasm") : url.toString().endsWith(".wasm")) {
|
|
@@ -81,7 +118,7 @@ self.fetch = async url => {
|
|
|
81
118
|
self.postMessage = data => {
|
|
82
119
|
parentPort.postMessage(data);
|
|
83
120
|
};
|
|
84
|
-
if (${options.type
|
|
121
|
+
if (${'module' === options.type}) {
|
|
85
122
|
import(${JSON.stringify(file)}).then(() => {
|
|
86
123
|
parentPort.on("message", data => {
|
|
87
124
|
if(self.onmessage) self.onmessage({
|
|
@@ -98,25 +135,31 @@ if (${options.type === 'module'}) {
|
|
|
98
135
|
require(${JSON.stringify(file)});
|
|
99
136
|
}
|
|
100
137
|
`;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
138
|
+
this.worker = new (__webpack_require__("worker_threads")).Worker(workerBootstrap, {
|
|
139
|
+
eval: true
|
|
140
|
+
});
|
|
141
|
+
this._onmessage = void 0;
|
|
142
|
+
}
|
|
143
|
+
set onmessage(value) {
|
|
144
|
+
if (this._onmessage) this.worker.off('message', this._onmessage);
|
|
145
|
+
this.worker.on('message', this._onmessage = (data)=>{
|
|
146
|
+
value({
|
|
147
|
+
data
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
postMessage(data) {
|
|
152
|
+
this.worker.postMessage(data);
|
|
153
|
+
}
|
|
154
|
+
terminate() {
|
|
155
|
+
return this.worker.terminate();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
})();
|
|
159
|
+
exports.createFakeWorker = __webpack_exports__.createFakeWorker;
|
|
160
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
161
|
+
"createFakeWorker"
|
|
162
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
163
|
+
Object.defineProperty(exports, '__esModule', {
|
|
164
|
+
value: true
|
|
165
|
+
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
declare function
|
|
1
|
+
export declare function createLazyTestEnv(globalTimeout?: number, nameSuffix?: string): {
|
|
2
2
|
setDefaultTimeout(time: any): void;
|
|
3
3
|
getNumberOfTests(): number;
|
|
4
4
|
it(...args: any[]): void;
|
|
5
5
|
beforeEach(...args: any[]): void;
|
|
6
6
|
afterEach(...args: any[]): void;
|
|
7
7
|
/** @type {import('@rstest/core').Expect} */
|
|
8
|
-
expect: import(
|
|
8
|
+
expect: import('@rstest/core').Expect;
|
|
9
9
|
rstest: import("@rstest/core", { with: { "resolution-mode": "import" } }).RstestUtilities;
|
|
10
10
|
};
|
|
11
|
-
export = _exports;
|