@rspack/test-tools 2.0.2 → 2.0.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.
Files changed (118) hide show
  1. package/dist/case/builtin.js +106 -66
  2. package/dist/case/cache.js +136 -122
  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 +21 -20
@@ -1,213 +1,281 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __webpack_modules__ = {
3
+ "terser-webpack-plugin" (module) {
4
+ module.exports = require("terser-webpack-plugin");
5
+ }
4
6
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createNormalCase = createNormalCase;
7
- exports.createHotNormalCase = createHotNormalCase;
8
- exports.createDevNormalCase = createDevNormalCase;
9
- exports.createProdNormalCase = createProdNormalCase;
10
- const node_fs_1 = __importDefault(require("node:fs"));
11
- const node_path_1 = __importDefault(require("node:path"));
12
- const core_1 = require("@rspack/core");
13
- const creator_1 = require("../test/creator");
14
- const common_1 = require("./common");
15
- const runner_1 = require("./runner");
16
- const NORMAL_CASES_ROOT = node_path_1.default.resolve(__TEST_PATH__, 'normalCases');
17
- const createCaseOptions = (hot, mode) => {
18
- return {
19
- clean: true,
20
- describe: false,
21
- steps: ({ name }) => [
22
- {
23
- config: async (context) => {
24
- const compiler = context.getCompiler();
25
- let options = defaultOptions(context, {
26
- plugins: hot ? [new core_1.HotModuleReplacementPlugin()] : [],
27
- }, mode);
28
- options = await (0, common_1.config)(context, name, ['rspack.config.js', 'webpack.config.js'], options);
29
- overrideOptions(context, options);
30
- compiler.setOptions(options);
31
- },
32
- compiler: async (context) => {
33
- await (0, common_1.compiler)(context, name);
34
- },
35
- build: async (context) => {
36
- await (0, common_1.build)(context, name);
37
- },
38
- run: async (env, context) => {
39
- await (0, common_1.run)(env, context, name, findBundle);
40
- },
41
- check: async (env, context) => {
42
- await (0, common_1.check)(env, context, name);
43
- },
44
- after: async (context) => {
45
- await (0, common_1.afterExecute)(context, name);
46
- },
47
- },
48
- ],
49
- runner: {
50
- key: (context, name, file) => name,
51
- runner: runner_1.createRunner,
52
- },
53
- concurrent: true,
7
+ var __webpack_module_cache__ = {};
8
+ function __webpack_require__(moduleId) {
9
+ var cachedModule = __webpack_module_cache__[moduleId];
10
+ if (void 0 !== cachedModule) return cachedModule.exports;
11
+ var module = __webpack_module_cache__[moduleId] = {
12
+ exports: {}
54
13
  };
55
- };
56
- const creator = new creator_1.BasicCaseCreator(createCaseOptions(false));
57
- function createNormalCase(name, src, dist) {
58
- creator.create(name, src, dist);
14
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
+ return module.exports;
59
16
  }
60
- const hotCreator = new creator_1.BasicCaseCreator(createCaseOptions(true));
61
- function createHotNormalCase(name, src, dist) {
62
- hotCreator.create(name, src, dist);
63
- }
64
- const devCreator = new creator_1.BasicCaseCreator(createCaseOptions(false, 'development'));
65
- function createDevNormalCase(name, src, dist) {
66
- devCreator.create(name, src, dist);
67
- }
68
- const prodCreator = new creator_1.BasicCaseCreator(createCaseOptions(false, 'production'));
69
- function createProdNormalCase(name, src, dist) {
70
- prodCreator.create(name, src, dist);
71
- }
72
- function findBundle(context, options) {
73
- const testConfig = context.getTestConfig();
74
- if (typeof testConfig.findBundle === 'function') {
75
- return testConfig.findBundle(0, options);
17
+ (()=>{
18
+ __webpack_require__.n = (module)=>{
19
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
20
+ __webpack_require__.d(getter, {
21
+ a: getter
22
+ });
23
+ return getter;
24
+ };
25
+ })();
26
+ (()=>{
27
+ __webpack_require__.d = (exports1, definition)=>{
28
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
29
+ enumerable: true,
30
+ get: definition[key]
31
+ });
32
+ };
33
+ })();
34
+ (()=>{
35
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
36
+ })();
37
+ (()=>{
38
+ __webpack_require__.r = (exports1)=>{
39
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
40
+ value: 'Module'
41
+ });
42
+ Object.defineProperty(exports1, '__esModule', {
43
+ value: true
44
+ });
45
+ };
46
+ })();
47
+ var __webpack_exports__ = {};
48
+ (()=>{
49
+ __webpack_require__.r(__webpack_exports__);
50
+ __webpack_require__.d(__webpack_exports__, {
51
+ createDevNormalCase: ()=>createDevNormalCase,
52
+ createHotNormalCase: ()=>createHotNormalCase,
53
+ createNormalCase: ()=>createNormalCase,
54
+ createProdNormalCase: ()=>createProdNormalCase
55
+ });
56
+ const external_node_fs_namespaceObject = require("node:fs");
57
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
58
+ const external_node_path_namespaceObject = require("node:path");
59
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
60
+ const core_namespaceObject = require("@rspack/core");
61
+ const creator_js_namespaceObject = require("../test/creator.js");
62
+ const external_common_js_namespaceObject = require("./common.js");
63
+ const external_runner_js_namespaceObject = require("./runner.js");
64
+ const NORMAL_CASES_ROOT = external_node_path_default().resolve(__TEST_PATH__, 'normalCases');
65
+ const createCaseOptions = (hot, mode)=>({
66
+ clean: true,
67
+ describe: false,
68
+ steps: ({ name })=>[
69
+ {
70
+ config: async (context)=>{
71
+ const compiler = context.getCompiler();
72
+ let options = defaultOptions(context, {
73
+ plugins: hot ? [
74
+ new core_namespaceObject.HotModuleReplacementPlugin()
75
+ ] : []
76
+ }, mode);
77
+ options = await (0, external_common_js_namespaceObject.config)(context, name, [
78
+ 'rspack.config.js',
79
+ 'webpack.config.js'
80
+ ], options);
81
+ overrideOptions(context, options);
82
+ compiler.setOptions(options);
83
+ },
84
+ compiler: async (context)=>{
85
+ await (0, external_common_js_namespaceObject.compiler)(context, name);
86
+ },
87
+ build: async (context)=>{
88
+ await (0, external_common_js_namespaceObject.build)(context, name);
89
+ },
90
+ run: async (env, context)=>{
91
+ await (0, external_common_js_namespaceObject.run)(env, context, name, findBundle);
92
+ },
93
+ check: async (env, context)=>{
94
+ await (0, external_common_js_namespaceObject.check)(env, context, name);
95
+ },
96
+ after: async (context)=>{
97
+ await (0, external_common_js_namespaceObject.afterExecute)(context, name);
98
+ }
99
+ }
100
+ ],
101
+ runner: {
102
+ key: (context, name, file)=>name,
103
+ runner: external_runner_js_namespaceObject.createRunner
104
+ },
105
+ concurrent: true
106
+ });
107
+ const creator = new creator_js_namespaceObject.BasicCaseCreator(createCaseOptions(false));
108
+ function createNormalCase(name, src, dist) {
109
+ creator.create(name, src, dist);
76
110
  }
77
- const filename = options.output?.filename;
78
- return typeof filename === 'string' ? filename : undefined;
79
- }
80
- function defaultOptions(context, compilerOptions, mode) {
81
- let testConfig = {};
82
- const testConfigPath = node_path_1.default.join(context.getSource(), 'test.config.js');
83
- if (node_fs_1.default.existsSync(testConfigPath)) {
84
- testConfig = require(testConfigPath);
111
+ const hotCreator = new creator_js_namespaceObject.BasicCaseCreator(createCaseOptions(true));
112
+ function createHotNormalCase(name, src, dist) {
113
+ hotCreator.create(name, src, dist);
85
114
  }
86
- const TerserPlugin = require('terser-webpack-plugin');
87
- const terserForTesting = new TerserPlugin({
88
- parallel: false,
89
- });
90
- return {
91
- amd: {},
92
- context: NORMAL_CASES_ROOT,
93
- entry: `./${node_path_1.default.relative(NORMAL_CASES_ROOT, context.getSource())}/`,
94
- target: compilerOptions?.target || 'async-node',
95
- devtool: mode === 'development' ? false : compilerOptions?.devtool,
96
- mode: compilerOptions?.mode || mode || 'none',
97
- optimization: compilerOptions?.mode
98
- ? {
115
+ const devCreator = new creator_js_namespaceObject.BasicCaseCreator(createCaseOptions(false, 'development'));
116
+ function createDevNormalCase(name, src, dist) {
117
+ devCreator.create(name, src, dist);
118
+ }
119
+ const prodCreator = new creator_js_namespaceObject.BasicCaseCreator(createCaseOptions(false, 'production'));
120
+ function createProdNormalCase(name, src, dist) {
121
+ prodCreator.create(name, src, dist);
122
+ }
123
+ function findBundle(context, options) {
124
+ const testConfig = context.getTestConfig();
125
+ if ('function' == typeof testConfig.findBundle) return testConfig.findBundle(0, options);
126
+ const filename = options.output?.filename;
127
+ return 'string' == typeof filename ? filename : void 0;
128
+ }
129
+ function defaultOptions(context, compilerOptions, mode) {
130
+ let testConfig = {};
131
+ const testConfigPath = external_node_path_default().join(context.getSource(), 'test.config.js');
132
+ if (external_node_fs_default().existsSync(testConfigPath)) testConfig = require(testConfigPath);
133
+ const TerserPlugin = __webpack_require__("terser-webpack-plugin");
134
+ const terserForTesting = new TerserPlugin({
135
+ parallel: false
136
+ });
137
+ return {
138
+ amd: {},
139
+ context: NORMAL_CASES_ROOT,
140
+ entry: `./${external_node_path_default().relative(NORMAL_CASES_ROOT, context.getSource())}/`,
141
+ target: compilerOptions?.target || 'async-node',
142
+ devtool: 'development' === mode ? false : compilerOptions?.devtool,
143
+ mode: compilerOptions?.mode || mode || 'none',
144
+ optimization: compilerOptions?.mode ? {
99
145
  emitOnErrors: true,
100
- minimizer: [terserForTesting],
146
+ minimizer: [
147
+ terserForTesting
148
+ ],
101
149
  minimize: false,
102
- ...testConfig.optimization,
103
- }
104
- : {
150
+ ...testConfig.optimization
151
+ } : {
105
152
  removeEmptyChunks: true,
106
153
  mergeDuplicateChunks: true,
107
- // CHANGE: rspack does not support `flagIncludedChunks` yet.
108
- // flagIncludedChunks: true,
109
154
  sideEffects: true,
110
155
  providedExports: true,
111
156
  usedExports: true,
112
157
  mangleExports: true,
113
158
  inlineExports: true,
114
- // CHANGE: rspack does not support `emitOnErrors` yet.
115
159
  emitOnErrors: true,
116
160
  concatenateModules: !!testConfig?.optimization?.concatenateModules,
117
161
  innerGraph: true,
118
- // CHANGE: size is not supported yet
119
- // moduleIds: "size",
120
- // chunkIds: "size",
121
162
  moduleIds: 'named',
122
163
  chunkIds: 'named',
123
164
  minimize: false,
124
- minimizer: [terserForTesting],
125
- ...compilerOptions?.optimization,
165
+ minimizer: [
166
+ terserForTesting
167
+ ],
168
+ ...compilerOptions?.optimization
126
169
  },
127
- // CHANGE: rspack does not support `performance` yet.
128
- // performance: {
129
- // hints: false
130
- // },
131
- node: {
132
- __dirname: 'mock',
133
- __filename: 'mock',
134
- },
135
- cache: compilerOptions?.cache && {
136
- // cacheDirectory,
137
- ...compilerOptions.cache,
138
- },
139
- output: {
140
- pathinfo: 'verbose',
141
- path: context.getDist(),
142
- filename: compilerOptions?.module ? 'bundle.mjs' : 'bundle.js',
143
- bundlerInfo: {
144
- force: false,
170
+ node: {
171
+ __dirname: 'mock',
172
+ __filename: 'mock'
145
173
  },
146
- ...(compilerOptions?.module ? { module: true } : {}),
147
- },
148
- resolve: {
149
- modules: ['web_modules', 'node_modules'],
150
- mainFields: ['webpack', 'browser', 'web', 'browserify', 'main'],
151
- aliasFields: ['browser'],
152
- extensions: ['.webpack.js', '.web.js', '.js', '.json'],
153
- },
154
- resolveLoader: {
155
- modules: ['web_loaders', 'web_modules', 'node_loaders', 'node_modules'],
156
- mainFields: ['webpackLoader', 'webLoader', 'loader', 'main'],
157
- extensions: ['.webpack-loader.js', '.web-loader.js', '.loader.js', '.js'],
158
- },
159
- module: {
160
- rules: [
161
- {
162
- test: /\.coffee$/,
163
- loader: 'coffee-loader',
164
- },
165
- {
166
- test: /\.pug/,
167
- loader: '@webdiscus/pug-loader',
168
- },
169
- {
170
- test: /\.wat$/i,
171
- loader: 'wast-loader',
172
- type: 'webassembly/async',
173
- },
174
- ],
175
- parser: {
176
- javascript: {
177
- requireAlias: true,
174
+ cache: compilerOptions?.cache && {
175
+ ...compilerOptions.cache
176
+ },
177
+ output: {
178
+ pathinfo: 'verbose',
179
+ path: context.getDist(),
180
+ filename: compilerOptions?.module ? 'bundle.mjs' : 'bundle.js',
181
+ bundlerInfo: {
182
+ force: false
178
183
  },
184
+ ...compilerOptions?.module ? {
185
+ module: true
186
+ } : {}
179
187
  },
180
- },
181
- plugins: (compilerOptions?.plugins || [])
182
- .concat(testConfig.plugins || [])
183
- .concat(function () {
184
- this.hooks.compilation.tap('TestCasesTest', (compilation) => {
185
- const hooks = [
186
- // CHANGE: the following hooks are not supported yet, so comment it out
187
- // "optimize",
188
- // "optimizeModules",
189
- // "optimizeChunks",
190
- // "afterOptimizeTree",
191
- // "afterOptimizeAssets"
192
- ];
193
- for (const hook of hooks) {
194
- compilation.hooks[hook].tap('TestCasesTest', () => compilation.checkConstraints());
188
+ resolve: {
189
+ modules: [
190
+ 'web_modules',
191
+ 'node_modules'
192
+ ],
193
+ mainFields: [
194
+ 'webpack',
195
+ 'browser',
196
+ 'web',
197
+ 'browserify',
198
+ 'main'
199
+ ],
200
+ aliasFields: [
201
+ 'browser'
202
+ ],
203
+ extensions: [
204
+ '.webpack.js',
205
+ '.web.js',
206
+ '.js',
207
+ '.json'
208
+ ]
209
+ },
210
+ resolveLoader: {
211
+ modules: [
212
+ 'web_loaders',
213
+ 'web_modules',
214
+ 'node_loaders',
215
+ 'node_modules'
216
+ ],
217
+ mainFields: [
218
+ 'webpackLoader',
219
+ 'webLoader',
220
+ 'loader',
221
+ 'main'
222
+ ],
223
+ extensions: [
224
+ '.webpack-loader.js',
225
+ '.web-loader.js',
226
+ '.loader.js',
227
+ '.js'
228
+ ]
229
+ },
230
+ module: {
231
+ rules: [
232
+ {
233
+ test: /\.coffee$/,
234
+ loader: 'coffee-loader'
235
+ },
236
+ {
237
+ test: /\.pug/,
238
+ loader: '@webdiscus/pug-loader'
239
+ },
240
+ {
241
+ test: /\.wat$/i,
242
+ loader: 'wast-loader',
243
+ type: 'webassembly/async'
244
+ }
245
+ ],
246
+ parser: {
247
+ javascript: {
248
+ requireAlias: true
249
+ }
195
250
  }
196
- });
197
- }),
198
- experiments: {
199
- asyncWebAssembly: true,
200
- // CHANGE: rspack does not support `backCompat` yet.
201
- // backCompat: false,
202
- // CHANGE: Rspack enables `css` by default.
203
- // Turning off here to fallback to webpack's default css processing logic.
204
- },
205
- };
206
- }
207
- function overrideOptions(context, options) {
208
- if (!global.printLogger) {
209
- options.infrastructureLogging = {
210
- level: 'error',
251
+ },
252
+ plugins: (compilerOptions?.plugins || []).concat(testConfig.plugins || []).concat(function() {
253
+ this.hooks.compilation.tap('TestCasesTest', (compilation)=>{
254
+ const hooks = [];
255
+ for (const hook of hooks)compilation.hooks[hook].tap('TestCasesTest', ()=>compilation.checkConstraints());
256
+ });
257
+ }),
258
+ experiments: {
259
+ asyncWebAssembly: true
260
+ }
211
261
  };
212
262
  }
213
- }
263
+ function overrideOptions(context, options) {
264
+ if (!global.printLogger) options.infrastructureLogging = {
265
+ level: 'error'
266
+ };
267
+ }
268
+ })();
269
+ exports.createDevNormalCase = __webpack_exports__.createDevNormalCase;
270
+ exports.createHotNormalCase = __webpack_exports__.createHotNormalCase;
271
+ exports.createNormalCase = __webpack_exports__.createNormalCase;
272
+ exports.createProdNormalCase = __webpack_exports__.createProdNormalCase;
273
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
274
+ "createDevNormalCase",
275
+ "createHotNormalCase",
276
+ "createNormalCase",
277
+ "createProdNormalCase"
278
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
279
+ Object.defineProperty(exports, '__esModule', {
280
+ value: true
281
+ });
@@ -1,26 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cachedStats = cachedStats;
4
- exports.createRunner = createRunner;
5
- exports.getMultiCompilerRunnerKey = getMultiCompilerRunnerKey;
6
- exports.createMultiCompilerRunner = createMultiCompilerRunner;
7
- const runner_1 = require("../runner");
8
- const debug_1 = require("../test/debug");
9
- const isWebTarget = (compilerOptions) => {
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
+ cachedStats: ()=>cachedStats,
28
+ createMultiCompilerRunner: ()=>createMultiCompilerRunner,
29
+ createRunner: ()=>createRunner,
30
+ getMultiCompilerRunnerKey: ()=>getMultiCompilerRunnerKey
31
+ });
32
+ const index_js_namespaceObject = require("../runner/index.js");
33
+ const debug_js_namespaceObject = require("../test/debug.js");
34
+ const isWebTarget = (compilerOptions)=>{
10
35
  const target = compilerOptions.target;
11
- if (Array.isArray(target)) {
12
- return target.some((t) => t === 'web' || t === 'webworker');
13
- }
14
- return target === 'web' || target === 'webworker';
36
+ if (Array.isArray(target)) return target.some((t)=>'web' === t || 'webworker' === t);
37
+ return 'web' === target || 'webworker' === target;
15
38
  };
16
39
  function cachedStats(context, name) {
17
40
  const compiler = context.getCompiler();
18
- const statsGetter = (() => {
41
+ const statsGetter = (()=>{
19
42
  let cached = null;
20
- return () => {
21
- if (cached) {
22
- return cached;
23
- }
43
+ return ()=>{
44
+ if (cached) return cached;
24
45
  cached = compiler.getStats().toJson({
25
46
  assets: true,
26
47
  chunks: true,
@@ -28,7 +49,7 @@ function cachedStats(context, name) {
28
49
  modules: true,
29
50
  entrypoints: true,
30
51
  chunkGroups: true,
31
- errorDetails: true,
52
+ errorDetails: true
32
53
  });
33
54
  return cached;
34
55
  };
@@ -48,33 +69,33 @@ function createRunner(context, name, file, env) {
48
69
  testConfig: context.getTestConfig(),
49
70
  source: context.getSource(),
50
71
  dist: context.getDist(),
51
- compilerOptions,
72
+ compilerOptions
52
73
  };
53
74
  const isWeb = isWebTarget(compilerOptions);
54
- if (isWeb) {
55
- return new runner_1.WebRunner({
56
- ...runnerOptions,
57
- runInNewContext: true,
58
- location: testConfig.location || 'https://test.cases/path/index.html',
59
- });
60
- }
61
- return new runner_1.NodeRunner(runnerOptions);
75
+ if (isWeb) return new index_js_namespaceObject.WebRunner({
76
+ ...runnerOptions,
77
+ runInNewContext: true,
78
+ location: testConfig.location || 'https://test.cases/path/index.html'
79
+ });
80
+ return new index_js_namespaceObject.NodeRunner(runnerOptions);
62
81
  }
63
82
  function getFileIndexHandler(context, name, file) {
64
83
  const multiFileIndexMap = context.getValue('multiFileIndexMap') || {};
65
84
  const runned = context.getValue('runned') || new Set();
66
- if (typeof multiFileIndexMap[file] === 'undefined') {
67
- throw new Error('Unexpect file in multiple runner');
68
- }
85
+ if (void 0 === multiFileIndexMap[file]) throw new Error('Unexpect file in multiple runner');
69
86
  const indexList = multiFileIndexMap[file];
70
- const seq = indexList.findIndex((index, n) => !runned.has(`${name}:${file}[${n}]`));
71
- if (seq === -1) {
72
- throw new Error(`File ${file} should run only ${indexList.length} times`);
73
- }
74
- const getIndex = () => [indexList[seq], seq];
75
- const flagIndex = () => runned.add(`${name}:${file}[${seq}]`);
87
+ const seq = indexList.findIndex((index, n)=>!runned.has(`${name}:${file}[${n}]`));
88
+ if (-1 === seq) throw new Error(`File ${file} should run only ${indexList.length} times`);
89
+ const getIndex = ()=>[
90
+ indexList[seq],
91
+ seq
92
+ ];
93
+ const flagIndex = ()=>runned.add(`${name}:${file}[${seq}]`);
76
94
  context.setValue('runned', runned);
77
- return { getIndex, flagIndex };
95
+ return {
96
+ getIndex,
97
+ flagIndex
98
+ };
78
99
  }
79
100
  function getMultiCompilerRunnerKey(context, name, file) {
80
101
  const { getIndex } = getFileIndexHandler(context, name, file);
@@ -87,14 +108,14 @@ function createMultiCompilerRunner(context, name, file, env) {
87
108
  const multiCompilerOptions = context.getValue('multiCompilerOptions') || [];
88
109
  const [index] = getIndex();
89
110
  const compilerOptions = multiCompilerOptions[index];
90
- const logs = context.getValue(debug_1.DEBUG_SCOPES.RunLogs);
91
- const errors = context.getValue(debug_1.DEBUG_SCOPES.RunErrors);
111
+ const logs = context.getValue(debug_js_namespaceObject.DEBUG_SCOPES.RunLogs);
112
+ const errors = context.getValue(debug_js_namespaceObject.DEBUG_SCOPES.RunErrors);
92
113
  let runner;
93
114
  const runnerOptions = {
94
115
  runInNewContext: false,
95
116
  cachable: true,
96
117
  env,
97
- stats: () => {
118
+ stats: ()=>{
98
119
  const s = cachedStats(context, name)();
99
120
  if (s.children?.length && s.children.length > 1) {
100
121
  s.__index__ = index;
@@ -108,19 +129,27 @@ function createMultiCompilerRunner(context, name, file, env) {
108
129
  dist: context.getDist(),
109
130
  compilerOptions,
110
131
  logs,
111
- errors,
132
+ errors
112
133
  };
113
134
  const isWeb = isWebTarget(compilerOptions);
114
- if (isWeb) {
115
- runner = new runner_1.WebRunner({
116
- ...runnerOptions,
117
- runInNewContext: true,
118
- location: testConfig.location || 'https://test.cases/path/index.html',
119
- });
120
- }
121
- else {
122
- runner = new runner_1.NodeRunner(runnerOptions);
123
- }
135
+ runner = isWeb ? new index_js_namespaceObject.WebRunner({
136
+ ...runnerOptions,
137
+ runInNewContext: true,
138
+ location: testConfig.location || 'https://test.cases/path/index.html'
139
+ }) : new index_js_namespaceObject.NodeRunner(runnerOptions);
124
140
  flagIndex();
125
141
  return runner;
126
142
  }
143
+ exports.cachedStats = __webpack_exports__.cachedStats;
144
+ exports.createMultiCompilerRunner = __webpack_exports__.createMultiCompilerRunner;
145
+ exports.createRunner = __webpack_exports__.createRunner;
146
+ exports.getMultiCompilerRunnerKey = __webpack_exports__.getMultiCompilerRunnerKey;
147
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
148
+ "cachedStats",
149
+ "createMultiCompilerRunner",
150
+ "createRunner",
151
+ "getMultiCompilerRunnerKey"
152
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
153
+ Object.defineProperty(exports, '__esModule', {
154
+ value: true
155
+ });