@rspack/test-tools 2.0.1 → 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 +152 -132
- 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 +24 -23
|
@@ -1,80 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const recordCheck = (success, message) => {
|
|
9
|
-
if (!success) {
|
|
10
|
-
failed = true;
|
|
11
|
-
console.error(`❌ ${message}`);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const sourceMap = require('source-map');
|
|
15
|
-
const path = require('node:path');
|
|
16
|
-
const sources = JSON.parse(outCodeMap).sources;
|
|
17
|
-
for (const source of sources) {
|
|
18
|
-
if (sources.filter((s) => s === source).length > 1) {
|
|
19
|
-
throw new Error(`Duplicate source ${JSON.stringify(source)} found in source map`);
|
|
20
|
-
}
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"node:path" (module) {
|
|
4
|
+
module.exports = require("node:path");
|
|
5
|
+
},
|
|
6
|
+
"source-map" (module) {
|
|
7
|
+
module.exports = require("source-map");
|
|
21
8
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
line: outLine,
|
|
39
|
-
column: outColumn,
|
|
9
|
+
};
|
|
10
|
+
var __webpack_module_cache__ = {};
|
|
11
|
+
function __webpack_require__(moduleId) {
|
|
12
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
15
|
+
exports: {}
|
|
16
|
+
};
|
|
17
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
18
|
+
return module.exports;
|
|
19
|
+
}
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
22
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: definition[key]
|
|
40
25
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const inLastLine = inLines[inLines.length - 1];
|
|
51
|
-
let inColumn = inLastLine.length;
|
|
52
|
-
if (path.extname(source) === 'css') {
|
|
53
|
-
const outMatch = /\s*content:\s*$/.exec(outLastLine);
|
|
54
|
-
const inMatch = /\bcontent:\s*$/.exec(inLastLine);
|
|
55
|
-
if (outMatch)
|
|
56
|
-
outColumn -= outMatch[0].length;
|
|
57
|
-
if (inMatch)
|
|
58
|
-
inColumn -= inMatch[0].length;
|
|
59
|
-
}
|
|
60
|
-
const expected = JSON.stringify({
|
|
61
|
-
source,
|
|
62
|
-
line: inLine,
|
|
63
|
-
column: checkColumn ? inColumn : 0,
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
(()=>{
|
|
29
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
30
|
+
})();
|
|
31
|
+
(()=>{
|
|
32
|
+
__webpack_require__.r = (exports1)=>{
|
|
33
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
34
|
+
value: 'Module'
|
|
64
35
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Also check the reverse mapping
|
|
68
|
-
const positions = map.allGeneratedPositionsFor({
|
|
69
|
-
source,
|
|
70
|
-
line: inLine,
|
|
71
|
-
column: checkColumn ? inColumn : 0,
|
|
36
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
37
|
+
value: true
|
|
72
38
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __webpack_exports__ = {};
|
|
42
|
+
(()=>{
|
|
43
|
+
__webpack_require__.r(__webpack_exports__);
|
|
44
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
45
|
+
default: ()=>checkSourceMap
|
|
46
|
+
});
|
|
47
|
+
async function checkSourceMap(out, outCodeMap, toSearch, _checkColumn = true) {
|
|
48
|
+
let failed = false;
|
|
49
|
+
const recordCheck = (success, message)=>{
|
|
50
|
+
if (!success) {
|
|
51
|
+
failed = true;
|
|
52
|
+
console.error(`❌ ${message}`);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const sourceMap = __webpack_require__("source-map");
|
|
56
|
+
const path = __webpack_require__("node:path");
|
|
57
|
+
const sources = JSON.parse(outCodeMap).sources;
|
|
58
|
+
for (const source of sources)if (sources.filter((s)=>s === source).length > 1) throw new Error(`Duplicate source ${JSON.stringify(source)} found in source map`);
|
|
59
|
+
const map = await new sourceMap.SourceMapConsumer(outCodeMap);
|
|
60
|
+
for(const id in toSearch){
|
|
61
|
+
const isSearchConfig = 'object' == typeof toSearch[id] && null !== toSearch[id];
|
|
62
|
+
const outId = isSearchConfig ? toSearch[id].outId ?? id : id;
|
|
63
|
+
const checkColumn = isSearchConfig ? toSearch[id].checkColumn ?? _checkColumn : _checkColumn;
|
|
64
|
+
const inSource = isSearchConfig ? toSearch[id].inSource : toSearch[id];
|
|
65
|
+
const outIndex = out.indexOf(outId);
|
|
66
|
+
if (outIndex < 0) throw new Error(`Failed to find "${outId}" in output ${out}`);
|
|
67
|
+
const outLines = out.slice(0, outIndex).split('\n');
|
|
68
|
+
const outLine = outLines.length;
|
|
69
|
+
const outLastLine = outLines[outLines.length - 1];
|
|
70
|
+
let outColumn = outLastLine.length;
|
|
71
|
+
const { source, line, column } = map.originalPositionFor({
|
|
72
|
+
line: outLine,
|
|
73
|
+
column: outColumn
|
|
74
|
+
});
|
|
75
|
+
recordCheck(source === inSource, `expected source: ${inSource}, observed source: ${source}@${line}:${column}, {out_source}@${outLine}:${outColumn}. ${checkColumn ? '' : '(column ignored)'}`);
|
|
76
|
+
const inCode = map.sourceContentFor(source);
|
|
77
|
+
let inIndex = inCode.indexOf(id);
|
|
78
|
+
if (inIndex < 0) inIndex = inCode.indexOf(`'${id}'`);
|
|
79
|
+
if (inIndex < 0) throw new Error(`Failed to find "${id}" in input ${inCode}`);
|
|
80
|
+
const inLines = inCode.slice(0, inIndex).split('\n');
|
|
81
|
+
const inLine = inLines.length;
|
|
82
|
+
const inLastLine = inLines[inLines.length - 1];
|
|
83
|
+
let inColumn = inLastLine.length;
|
|
84
|
+
if ('css' === path.extname(source)) {
|
|
85
|
+
const outMatch = /\s*content:\s*$/.exec(outLastLine);
|
|
86
|
+
const inMatch = /\bcontent:\s*$/.exec(inLastLine);
|
|
87
|
+
if (outMatch) outColumn -= outMatch[0].length;
|
|
88
|
+
if (inMatch) inColumn -= inMatch[0].length;
|
|
89
|
+
}
|
|
90
|
+
const expected = JSON.stringify({
|
|
91
|
+
source,
|
|
92
|
+
line: inLine,
|
|
93
|
+
column: checkColumn ? inColumn : 0
|
|
94
|
+
});
|
|
95
|
+
const observed = JSON.stringify({
|
|
96
|
+
source,
|
|
97
|
+
line,
|
|
98
|
+
column
|
|
99
|
+
});
|
|
100
|
+
recordCheck(expected === observed, `expected original position: ${expected}, observed original position: ${observed}, out: ${outLine},${outColumn},${outIndex}:${outId}, ${checkColumn ? '' : '(column ignored)'}`);
|
|
101
|
+
const positions = map.allGeneratedPositionsFor({
|
|
102
|
+
source,
|
|
103
|
+
line: inLine,
|
|
104
|
+
column: checkColumn ? inColumn : 0
|
|
105
|
+
});
|
|
106
|
+
recordCheck(positions.length > 0, `expected generated positions: 1, observed generated positions: ${positions.length} ${checkColumn ? '' : '(column ignored)'}`);
|
|
107
|
+
let found = false;
|
|
108
|
+
for (const { line, column } of positions)if (line === outLine) {
|
|
109
|
+
if (!checkColumn && 0 === column) {
|
|
78
110
|
found = true;
|
|
79
111
|
break;
|
|
80
112
|
}
|
|
@@ -83,13 +115,20 @@ async function checkSourceMap(out, outCodeMap, toSearch, _checkColumn = true) {
|
|
|
83
115
|
break;
|
|
84
116
|
}
|
|
85
117
|
}
|
|
118
|
+
const expectedPosition = JSON.stringify({
|
|
119
|
+
line: outLine,
|
|
120
|
+
column: outColumn
|
|
121
|
+
});
|
|
122
|
+
const observedPositions = JSON.stringify(positions);
|
|
123
|
+
recordCheck(found, `expected generated position: ${expectedPosition}, observed generated positions: ${observedPositions} ${checkColumn ? '' : '(column ignored)'}`);
|
|
86
124
|
}
|
|
87
|
-
|
|
88
|
-
line: outLine,
|
|
89
|
-
column: outColumn,
|
|
90
|
-
});
|
|
91
|
-
const observedPositions = JSON.stringify(positions);
|
|
92
|
-
recordCheck(found, `expected generated position: ${expectedPosition}, observed generated positions: ${observedPositions} ${checkColumn ? '' : '(column ignored)'}`);
|
|
125
|
+
return !failed;
|
|
93
126
|
}
|
|
94
|
-
|
|
95
|
-
|
|
127
|
+
})();
|
|
128
|
+
exports["default"] = __webpack_exports__["default"];
|
|
129
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
130
|
+
"default"
|
|
131
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
132
|
+
Object.defineProperty(exports, '__esModule', {
|
|
133
|
+
value: true
|
|
134
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function checkChunkModules(statsJson: any, chunkModulesMap: any, strict?: boolean): boolean;
|
|
1
|
+
export declare function checkChunkModules(statsJson: any, chunkModulesMap: any, strict?: boolean): boolean;
|
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
checkChunkModules: ()=>checkChunkModules
|
|
28
|
+
});
|
|
29
|
+
function checkChunkModules(statsJson, chunkModulesMap, strict = true) {
|
|
30
|
+
for (const chunkId of Reflect.ownKeys(chunkModulesMap)){
|
|
5
31
|
const chunk = getChunk(statsJson, chunkId);
|
|
6
32
|
const expectedModules = chunkModulesMap[chunkId];
|
|
7
|
-
const chunkModules = chunk.modules.map((m)
|
|
8
|
-
if (strict && expectedModules.length !== chunkModules.length) {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
for (const module of expectedModules) {
|
|
12
|
-
if (!chunkModules.find((moduleId) => moduleId.includes(module))) {
|
|
13
|
-
throw new Error(`chunk ${chunkId} has no module contains id: ${module}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
33
|
+
const chunkModules = chunk.modules.map((m)=>m.identifier);
|
|
34
|
+
if (strict && expectedModules.length !== chunkModules.length) throw new Error(`expect chunk ${chunkId} has ${expectedModules.length} modules: ${expectedModules}\nbut received ${chunkModules.length} modules`);
|
|
35
|
+
for (const module of expectedModules)if (!chunkModules.find((moduleId)=>moduleId.includes(module))) throw new Error(`chunk ${chunkId} has no module contains id: ${module}`);
|
|
16
36
|
}
|
|
17
37
|
return true;
|
|
18
|
-
}
|
|
38
|
+
}
|
|
19
39
|
function getChunk(statsJson, id) {
|
|
20
|
-
const chunk = statsJson.chunks.find((chunk)
|
|
21
|
-
if (!chunk) {
|
|
22
|
-
throw new Error(`cannot find chunk with id: ${id}`);
|
|
23
|
-
}
|
|
40
|
+
const chunk = statsJson.chunks.find((chunk)=>String(chunk.id).includes(String(id)));
|
|
41
|
+
if (!chunk) throw new Error(`cannot find chunk with id: ${id}`);
|
|
24
42
|
return chunk;
|
|
25
43
|
}
|
|
44
|
+
exports.checkChunkModules = __webpack_exports__.checkChunkModules;
|
|
45
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
46
|
+
"checkChunkModules"
|
|
47
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
|
+
Object.defineProperty(exports, '__esModule', {
|
|
49
|
+
value: true
|
|
50
|
+
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export = _exports;
|
|
1
|
+
export declare function expectWarningFactory(): (...regexp: any[]) => void;
|
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
expectWarningFactory: ()=>expectWarningFactory
|
|
28
|
+
});
|
|
29
|
+
function expectWarningFactory() {
|
|
4
30
|
const warnings = [];
|
|
5
31
|
let oldWarn;
|
|
6
|
-
beforeEach(()
|
|
32
|
+
beforeEach(()=>{
|
|
7
33
|
oldWarn = console.warn;
|
|
8
|
-
console.warn = (m)
|
|
34
|
+
console.warn = (m)=>warnings.push(m);
|
|
9
35
|
});
|
|
10
|
-
afterEach(()
|
|
36
|
+
afterEach(()=>{
|
|
11
37
|
expectWarning();
|
|
12
38
|
console.warn = oldWarn;
|
|
13
39
|
});
|
|
14
|
-
const expectWarning = (...regexp)
|
|
15
|
-
expect(warnings).toEqual(regexp.map((r)
|
|
40
|
+
const expectWarning = (...regexp)=>{
|
|
41
|
+
expect(warnings).toEqual(regexp.map((r)=>expect.stringMatching(r)));
|
|
16
42
|
warnings.length = 0;
|
|
17
43
|
};
|
|
18
44
|
return expectWarning;
|
|
19
|
-
}
|
|
45
|
+
}
|
|
46
|
+
exports.expectWarningFactory = __webpack_exports__.expectWarningFactory;
|
|
47
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
48
|
+
"expectWarningFactory"
|
|
49
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
50
|
+
Object.defineProperty(exports, '__esModule', {
|
|
51
|
+
value: true
|
|
52
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
export declare const FilteredStatus: {
|
|
2
|
+
TODO: string;
|
|
3
|
+
PARTIAL_PASS: string;
|
|
4
|
+
FAILED: string;
|
|
5
|
+
NO_PLAN: string;
|
|
6
|
+
};
|
|
7
|
+
declare function decodeFilteredTest(encoded: any): any;
|
|
8
|
+
declare function normalizeFilteredTestName(flag: any, testName: any): string;
|
|
9
|
+
export { decodeFilteredTest, normalizeFilteredTestName };
|
|
@@ -1,29 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
FilteredStatus: ()=>FilteredStatus,
|
|
28
|
+
decodeFilteredTest: ()=>decodeFilteredTest,
|
|
29
|
+
normalizeFilteredTestName: ()=>normalizeFilteredTestName
|
|
30
|
+
});
|
|
3
31
|
const FilteredStatus = {
|
|
4
32
|
TODO: 'TODO',
|
|
5
33
|
PARTIAL_PASS: 'PARTIAL_PASS',
|
|
6
34
|
FAILED: 'FAILED',
|
|
7
|
-
NO_PLAN: 'NO_PLAN'
|
|
35
|
+
NO_PLAN: 'NO_PLAN'
|
|
8
36
|
};
|
|
9
37
|
function validateFilteredStatus(status) {
|
|
10
38
|
return Object.values(FilteredStatus).includes(status);
|
|
11
39
|
}
|
|
12
40
|
function normalizeFilterFlag(flag, testName) {
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
if (false === flag) return {
|
|
42
|
+
status: FilteredStatus.TODO,
|
|
43
|
+
reason: 'TODO'
|
|
44
|
+
};
|
|
45
|
+
if (-1 === flag) return {
|
|
46
|
+
status: FilteredStatus.NO_PLAN,
|
|
47
|
+
reason: 'No plan'
|
|
48
|
+
};
|
|
49
|
+
if ('string' == typeof flag) return {
|
|
50
|
+
status: FilteredStatus.FAILED,
|
|
51
|
+
reason: flag
|
|
52
|
+
};
|
|
22
53
|
if (Array.isArray(flag)) {
|
|
23
54
|
const [status, reason = 'empty'] = flag;
|
|
24
|
-
if (validateFilteredStatus(status)) {
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
if (validateFilteredStatus(status)) return {
|
|
56
|
+
status,
|
|
57
|
+
reason
|
|
58
|
+
};
|
|
27
59
|
}
|
|
28
60
|
throw new Error(`Unvalidate filter flag "${flag}" for "${testName}"`);
|
|
29
61
|
}
|
|
@@ -33,18 +65,26 @@ function encodeFilteredTest(status, reason) {
|
|
|
33
65
|
function decodeFilteredTest(encoded) {
|
|
34
66
|
const regex = /(.*) {{ status = (.*), reason = (.*) }}$/;
|
|
35
67
|
const result = encoded.match(regex);
|
|
36
|
-
if (
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
68
|
+
if (null === result) return result;
|
|
39
69
|
const [, fullName, status, reason] = result;
|
|
40
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
fullName,
|
|
72
|
+
status,
|
|
73
|
+
reason
|
|
74
|
+
};
|
|
41
75
|
}
|
|
42
76
|
function normalizeFilteredTestName(flag, testName) {
|
|
43
77
|
const { status, reason } = normalizeFilterFlag(flag, testName);
|
|
44
78
|
return encodeFilteredTest(status, reason);
|
|
45
79
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
80
|
+
exports.FilteredStatus = __webpack_exports__.FilteredStatus;
|
|
81
|
+
exports.decodeFilteredTest = __webpack_exports__.decodeFilteredTest;
|
|
82
|
+
exports.normalizeFilteredTestName = __webpack_exports__.normalizeFilteredTestName;
|
|
83
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
84
|
+
"FilteredStatus",
|
|
85
|
+
"decodeFilteredTest",
|
|
86
|
+
"normalizeFilteredTestName"
|
|
87
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
88
|
+
Object.defineProperty(exports, '__esModule', {
|
|
89
|
+
value: true
|
|
90
|
+
});
|
package/dist/helper/win.js
CHANGED
|
@@ -1,10 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
escapeSep: ()=>escapeSep
|
|
37
|
+
});
|
|
38
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
39
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
8
40
|
function escapeSep(str) {
|
|
9
|
-
return str.split(
|
|
41
|
+
return str.split(external_node_path_default().win32.sep).join(external_node_path_default().posix.sep);
|
|
10
42
|
}
|
|
43
|
+
exports.escapeSep = __webpack_exports__.escapeSep;
|
|
44
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
+
"escapeSep"
|
|
46
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
47
|
+
Object.defineProperty(exports, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|