@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.
Files changed (118) hide show
  1. package/dist/case/builtin.js +106 -66
  2. package/dist/case/cache.js +152 -132
  3. package/dist/case/common.d.ts +4 -4
  4. package/dist/case/common.js +162 -157
  5. package/dist/case/compiler.d.ts +4 -4
  6. package/dist/case/compiler.js +75 -64
  7. package/dist/case/config.js +112 -74
  8. package/dist/case/defaults.js +136 -83
  9. package/dist/case/diagnostic.js +112 -84
  10. package/dist/case/error.d.ts +4 -4
  11. package/dist/case/error.js +105 -89
  12. package/dist/case/esm-output.js +118 -87
  13. package/dist/case/example.js +73 -35
  14. package/dist/case/hash.js +74 -59
  15. package/dist/case/hook.js +151 -138
  16. package/dist/case/hot-step.js +130 -161
  17. package/dist/case/hot.js +148 -134
  18. package/dist/case/incremental.js +91 -58
  19. package/dist/case/index.js +134 -51
  20. package/dist/case/multi-compiler.d.ts +4 -4
  21. package/dist/case/multi-compiler.js +81 -56
  22. package/dist/case/native-watcher.js +62 -30
  23. package/dist/case/normal.js +253 -185
  24. package/dist/case/runner.js +80 -51
  25. package/dist/case/serial.js +47 -16
  26. package/dist/case/stats-api.d.ts +4 -4
  27. package/dist/case/stats-api.js +63 -43
  28. package/dist/case/stats-output.d.ts +3 -3
  29. package/dist/case/stats-output.js +147 -152
  30. package/dist/case/treeshaking.js +66 -35
  31. package/dist/case/watch.d.ts +3 -19
  32. package/dist/case/watch.js +204 -224
  33. package/dist/compiler.js +222 -195
  34. package/dist/helper/directory.js +83 -71
  35. package/dist/helper/disable-iconv-lite-warning.js +35 -9
  36. package/dist/helper/expect/diff.js +39 -10
  37. package/dist/helper/expect/error.js +62 -30
  38. package/dist/helper/expect/placeholder.js +47 -21
  39. package/dist/helper/expect/rspack.js +35 -13
  40. package/dist/helper/expect/to-be-typeof.js +39 -7
  41. package/dist/helper/expect/to-end-with.js +40 -8
  42. package/dist/helper/expect/to-match-file-snapshot.js +103 -80
  43. package/dist/helper/hot-update/index.js +35 -4
  44. package/dist/helper/hot-update/loader.d.ts +1 -0
  45. package/dist/helper/hot-update/loader.js +39 -4
  46. package/dist/helper/hot-update/plugin.d.ts +1 -1
  47. package/dist/helper/hot-update/plugin.js +87 -74
  48. package/dist/helper/index.js +138 -24
  49. package/dist/helper/is.js +51 -10
  50. package/dist/helper/legacy/EventSourceForNode.d.ts +11 -3
  51. package/dist/helper/legacy/EventSourceForNode.js +83 -37
  52. package/dist/helper/legacy/LogTestPlugin.d.ts +2 -3
  53. package/dist/helper/legacy/LogTestPlugin.js +39 -6
  54. package/dist/helper/legacy/asModule.d.ts +3 -3
  55. package/dist/helper/legacy/asModule.js +68 -19
  56. package/dist/helper/legacy/captureStdio.d.ts +1 -2
  57. package/dist/helper/legacy/captureStdio.js +69 -29
  58. package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -2
  59. package/dist/helper/legacy/checkArrayExpectation.js +132 -121
  60. package/dist/helper/legacy/copyDiff.d.ts +1 -2
  61. package/dist/helper/legacy/copyDiff.js +86 -42
  62. package/dist/helper/legacy/createFakeWorker.d.ts +2 -3
  63. package/dist/helper/legacy/createFakeWorker.js +90 -47
  64. package/dist/helper/legacy/createLazyTestEnv.d.ts +2 -3
  65. package/dist/helper/legacy/createLazyTestEnv.js +70 -59
  66. package/dist/helper/legacy/currentScript.d.ts +2 -2
  67. package/dist/helper/legacy/currentScript.js +35 -2
  68. package/dist/helper/legacy/deprecationTracking.d.ts +1 -1
  69. package/dist/helper/legacy/deprecationTracking.js +53 -28
  70. package/dist/helper/legacy/expectSource.d.ts +3 -2
  71. package/dist/helper/legacy/expectSource.js +42 -18
  72. package/dist/helper/legacy/fakeSystem.d.ts +12 -9
  73. package/dist/helper/legacy/fakeSystem.js +68 -58
  74. package/dist/helper/legacy/findOutputFiles.d.ts +7 -2
  75. package/dist/helper/legacy/findOutputFiles.js +60 -13
  76. package/dist/helper/legacy/parseResource.d.ts +1 -1
  77. package/dist/helper/legacy/parseResource.js +36 -6
  78. package/dist/helper/legacy/regexEscape.d.ts +1 -2
  79. package/dist/helper/legacy/regexEscape.js +39 -5
  80. package/dist/helper/legacy/supportDefaultAssignment.d.ts +1 -2
  81. package/dist/helper/legacy/supportDefaultAssignment.js +40 -7
  82. package/dist/helper/legacy/supportsTextDecoder.d.ts +1 -2
  83. package/dist/helper/legacy/supportsTextDecoder.js +40 -6
  84. package/dist/helper/legacy/supportsUsing.d.ts +1 -2
  85. package/dist/helper/legacy/supportsUsing.js +40 -7
  86. package/dist/helper/legacy/urlToRelativePath.d.ts +2 -2
  87. package/dist/helper/legacy/urlToRelativePath.js +56 -7
  88. package/dist/helper/parse-modules.js +52 -42
  89. package/dist/helper/read-config-file.js +60 -18
  90. package/dist/helper/serializers.js +62 -33
  91. package/dist/helper/setup-env.js +81 -91
  92. package/dist/helper/setup-expect.js +13 -13
  93. package/dist/helper/setup-wasm.js +18 -9
  94. package/dist/helper/stringify-config.js +44 -26
  95. package/dist/helper/update-snapshot.js +35 -3
  96. package/dist/helper/util/checkSourceMap.js +119 -80
  97. package/dist/helper/util/checkStats.d.ts +1 -1
  98. package/dist/helper/util/checkStats.js +42 -17
  99. package/dist/helper/util/expectWarningFactory.d.ts +1 -2
  100. package/dist/helper/util/expectWarningFactory.js +41 -8
  101. package/dist/helper/util/filterUtil.d.ts +9 -8
  102. package/dist/helper/util/filterUtil.js +63 -23
  103. package/dist/helper/win.js +46 -7
  104. package/dist/index.js +115 -23
  105. package/dist/plugin/index.js +55 -14
  106. package/dist/plugin/lazy-compilation-test-plugin.js +55 -41
  107. package/dist/reporter/index.js +55 -14
  108. package/dist/reporter/streamed-events-reporter.js +51 -77
  109. package/dist/runner/index.js +62 -15
  110. package/dist/runner/node/index.js +365 -431
  111. package/dist/runner/web/index.js +278 -263
  112. package/dist/test/context.js +67 -41
  113. package/dist/test/creator.js +135 -167
  114. package/dist/test/debug.js +89 -58
  115. package/dist/test/tester.js +94 -74
  116. package/dist/type.d.ts +10 -9
  117. package/dist/type.js +43 -9
  118. package/package.json +24 -23
@@ -1,80 +1,112 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = checkSourceMap;
4
- // @ts-nocheck
5
- // Check the mapping of various key locations back to the original source
6
- async function checkSourceMap(out, outCodeMap, toSearch, _checkColumn = true) {
7
- let failed = false;
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
- const map = await new sourceMap.SourceMapConsumer(outCodeMap);
23
- for (const id in toSearch) {
24
- const isSearchConfig = typeof toSearch[id] === 'object' && toSearch[id] !== null;
25
- const outId = isSearchConfig ? (toSearch[id].outId ?? id) : id;
26
- const checkColumn = isSearchConfig
27
- ? (toSearch[id].checkColumn ?? _checkColumn)
28
- : _checkColumn;
29
- const inSource = isSearchConfig ? toSearch[id].inSource : toSearch[id];
30
- const outIndex = out.indexOf(outId);
31
- if (outIndex < 0)
32
- throw new Error(`Failed to find "${outId}" in output ${out}`);
33
- const outLines = out.slice(0, outIndex).split('\n');
34
- const outLine = outLines.length;
35
- const outLastLine = outLines[outLines.length - 1];
36
- let outColumn = outLastLine.length;
37
- const { source, line, column } = map.originalPositionFor({
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
- recordCheck(source === inSource, `expected source: ${inSource}, observed source: ${source}@${line}:${column}, {out_source}@${outLine}:${outColumn}. ${checkColumn ? '' : '(column ignored)'}`);
42
- const inCode = map.sourceContentFor(source);
43
- let inIndex = inCode.indexOf(id);
44
- if (inIndex < 0)
45
- inIndex = inCode.indexOf(`'${id}'`);
46
- if (inIndex < 0)
47
- throw new Error(`Failed to find "${id}" in input ${inCode}`);
48
- const inLines = inCode.slice(0, inIndex).split('\n');
49
- const inLine = inLines.length;
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
- const observed = JSON.stringify({ source, line, column });
66
- recordCheck(expected === observed, `expected original position: ${expected}, observed original position: ${observed}, out: ${`${outLine},${outColumn},${outIndex}:${outId}`}, ${checkColumn ? '' : '(column ignored)'}`);
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
- recordCheck(positions.length > 0, `expected generated positions: 1, observed generated positions: ${positions.length} ${checkColumn ? '' : '(column ignored)'}`);
74
- let found = false;
75
- for (const { line, column } of positions) {
76
- if (line === outLine) {
77
- if (!checkColumn && column === 0) {
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
- const expectedPosition = JSON.stringify({
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
- return !failed;
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
- // @ts-nocheck
3
- exports.checkChunkModules = function checkChunkModules(statsJson, chunkModulesMap, strict = true) {
4
- for (const chunkId of Reflect.ownKeys(chunkModulesMap)) {
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) => m.identifier);
8
- if (strict && expectedModules.length !== chunkModules.length) {
9
- throw new Error(`expect chunk ${chunkId} has ${expectedModules.length} modules: ${expectedModules}\nbut received ${chunkModules.length} modules`);
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) => chunk.id.includes(id));
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 _exports(): (...regexp: any[]) => void;
2
- export = _exports;
1
+ export declare function expectWarningFactory(): (...regexp: any[]) => void;
@@ -1,19 +1,52 @@
1
1
  "use strict";
2
- // @ts-nocheck
3
- module.exports = () => {
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) => warnings.push(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) => expect.stringMatching(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 namespace FilteredStatus {
2
- let TODO: string;
3
- let PARTIAL_PASS: string;
4
- let FAILED: string;
5
- let NO_PLAN: string;
6
- }
7
- export function decodeFilteredTest(encoded: any): any;
8
- export function normalizeFilteredTestName(flag: any, testName: any): string;
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
- // @ts-nocheck
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 (flag === false) {
14
- return { status: FilteredStatus.TODO, reason: 'TODO' };
15
- }
16
- if (flag === -1) {
17
- return { status: FilteredStatus.NO_PLAN, reason: 'No plan' };
18
- }
19
- if (typeof flag === 'string') {
20
- return { status: FilteredStatus.FAILED, reason: flag };
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
- return { status, reason };
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 (result === null) {
37
- return result;
38
- }
68
+ if (null === result) return result;
39
69
  const [, fullName, status, reason] = result;
40
- return { fullName, status, reason };
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
- module.exports = {
47
- FilteredStatus,
48
- decodeFilteredTest,
49
- normalizeFilteredTestName,
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
+ });
@@ -1,10 +1,49 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.escapeSep = escapeSep;
7
- const node_path_1 = __importDefault(require("node:path"));
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(node_path_1.default.win32.sep).join(node_path_1.default.posix.sep);
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
+ });