@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
package/dist/case/index.js
CHANGED
|
@@ -1,52 +1,135 @@
|
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
createBuiltinCase: ()=>external_builtin_js_namespaceObject.createBuiltinCase,
|
|
28
|
+
createCacheCase: ()=>external_cache_js_namespaceObject.createCacheCase,
|
|
29
|
+
createCompilerCase: ()=>external_compiler_js_namespaceObject.createCompilerCase,
|
|
30
|
+
createConfigCase: ()=>external_config_js_namespaceObject.createConfigCase,
|
|
31
|
+
createDefaultsCase: ()=>external_defaults_js_namespaceObject.createDefaultsCase,
|
|
32
|
+
createDevNormalCase: ()=>external_normal_js_namespaceObject.createDevNormalCase,
|
|
33
|
+
createDiagnosticCase: ()=>external_diagnostic_js_namespaceObject.createDiagnosticCase,
|
|
34
|
+
createErrorCase: ()=>external_error_js_namespaceObject.createErrorCase,
|
|
35
|
+
createEsmOutputCase: ()=>external_esm_output_js_namespaceObject.createEsmOutputCase,
|
|
36
|
+
createExampleCase: ()=>external_example_js_namespaceObject.createExampleCase,
|
|
37
|
+
createHashCase: ()=>external_hash_js_namespaceObject.createHashCase,
|
|
38
|
+
createHookCase: ()=>external_hook_js_namespaceObject.createHookCase,
|
|
39
|
+
createHotCase: ()=>external_hot_js_namespaceObject.createHotCase,
|
|
40
|
+
createHotIncrementalCase: ()=>external_incremental_js_namespaceObject.createHotIncrementalCase,
|
|
41
|
+
createHotNormalCase: ()=>external_normal_js_namespaceObject.createHotNormalCase,
|
|
42
|
+
createHotStepCase: ()=>external_hot_step_js_namespaceObject.createHotStepCase,
|
|
43
|
+
createMultiCompilerCase: ()=>external_multi_compiler_js_namespaceObject.createMultiCompilerCase,
|
|
44
|
+
createNativeWatcher: ()=>external_native_watcher_js_namespaceObject.createNativeWatcher,
|
|
45
|
+
createNormalCase: ()=>external_normal_js_namespaceObject.createNormalCase,
|
|
46
|
+
createProdNormalCase: ()=>external_normal_js_namespaceObject.createProdNormalCase,
|
|
47
|
+
createSerialCase: ()=>external_serial_js_namespaceObject.createSerialCase,
|
|
48
|
+
createStatsAPICase: ()=>external_stats_api_js_namespaceObject.createStatsAPICase,
|
|
49
|
+
createStatsOutputCase: ()=>external_stats_output_js_namespaceObject.createStatsOutputCase,
|
|
50
|
+
createTreeShakingCase: ()=>external_treeshaking_js_namespaceObject.createTreeShakingCase,
|
|
51
|
+
createWatchCase: ()=>external_watch_js_namespaceObject.createWatchCase,
|
|
52
|
+
createWatchIncrementalCase: ()=>external_incremental_js_namespaceObject.createWatchIncrementalCase,
|
|
53
|
+
getRspackDefaultConfig: ()=>external_defaults_js_namespaceObject.getRspackDefaultConfig
|
|
54
|
+
});
|
|
55
|
+
const external_builtin_js_namespaceObject = require("./builtin.js");
|
|
56
|
+
const external_cache_js_namespaceObject = require("./cache.js");
|
|
57
|
+
const external_compiler_js_namespaceObject = require("./compiler.js");
|
|
58
|
+
const external_config_js_namespaceObject = require("./config.js");
|
|
59
|
+
const external_defaults_js_namespaceObject = require("./defaults.js");
|
|
60
|
+
const external_diagnostic_js_namespaceObject = require("./diagnostic.js");
|
|
61
|
+
const external_error_js_namespaceObject = require("./error.js");
|
|
62
|
+
const external_esm_output_js_namespaceObject = require("./esm-output.js");
|
|
63
|
+
const external_example_js_namespaceObject = require("./example.js");
|
|
64
|
+
const external_hash_js_namespaceObject = require("./hash.js");
|
|
65
|
+
const external_hook_js_namespaceObject = require("./hook.js");
|
|
66
|
+
const external_hot_js_namespaceObject = require("./hot.js");
|
|
67
|
+
const external_hot_step_js_namespaceObject = require("./hot-step.js");
|
|
68
|
+
const external_incremental_js_namespaceObject = require("./incremental.js");
|
|
69
|
+
const external_multi_compiler_js_namespaceObject = require("./multi-compiler.js");
|
|
70
|
+
const external_native_watcher_js_namespaceObject = require("./native-watcher.js");
|
|
71
|
+
const external_normal_js_namespaceObject = require("./normal.js");
|
|
72
|
+
const external_serial_js_namespaceObject = require("./serial.js");
|
|
73
|
+
const external_stats_api_js_namespaceObject = require("./stats-api.js");
|
|
74
|
+
const external_stats_output_js_namespaceObject = require("./stats-output.js");
|
|
75
|
+
const external_treeshaking_js_namespaceObject = require("./treeshaking.js");
|
|
76
|
+
const external_watch_js_namespaceObject = require("./watch.js");
|
|
77
|
+
exports.createBuiltinCase = __webpack_exports__.createBuiltinCase;
|
|
78
|
+
exports.createCacheCase = __webpack_exports__.createCacheCase;
|
|
79
|
+
exports.createCompilerCase = __webpack_exports__.createCompilerCase;
|
|
80
|
+
exports.createConfigCase = __webpack_exports__.createConfigCase;
|
|
81
|
+
exports.createDefaultsCase = __webpack_exports__.createDefaultsCase;
|
|
82
|
+
exports.createDevNormalCase = __webpack_exports__.createDevNormalCase;
|
|
83
|
+
exports.createDiagnosticCase = __webpack_exports__.createDiagnosticCase;
|
|
84
|
+
exports.createErrorCase = __webpack_exports__.createErrorCase;
|
|
85
|
+
exports.createEsmOutputCase = __webpack_exports__.createEsmOutputCase;
|
|
86
|
+
exports.createExampleCase = __webpack_exports__.createExampleCase;
|
|
87
|
+
exports.createHashCase = __webpack_exports__.createHashCase;
|
|
88
|
+
exports.createHookCase = __webpack_exports__.createHookCase;
|
|
89
|
+
exports.createHotCase = __webpack_exports__.createHotCase;
|
|
90
|
+
exports.createHotIncrementalCase = __webpack_exports__.createHotIncrementalCase;
|
|
91
|
+
exports.createHotNormalCase = __webpack_exports__.createHotNormalCase;
|
|
92
|
+
exports.createHotStepCase = __webpack_exports__.createHotStepCase;
|
|
93
|
+
exports.createMultiCompilerCase = __webpack_exports__.createMultiCompilerCase;
|
|
94
|
+
exports.createNativeWatcher = __webpack_exports__.createNativeWatcher;
|
|
95
|
+
exports.createNormalCase = __webpack_exports__.createNormalCase;
|
|
96
|
+
exports.createProdNormalCase = __webpack_exports__.createProdNormalCase;
|
|
97
|
+
exports.createSerialCase = __webpack_exports__.createSerialCase;
|
|
98
|
+
exports.createStatsAPICase = __webpack_exports__.createStatsAPICase;
|
|
99
|
+
exports.createStatsOutputCase = __webpack_exports__.createStatsOutputCase;
|
|
100
|
+
exports.createTreeShakingCase = __webpack_exports__.createTreeShakingCase;
|
|
101
|
+
exports.createWatchCase = __webpack_exports__.createWatchCase;
|
|
102
|
+
exports.createWatchIncrementalCase = __webpack_exports__.createWatchIncrementalCase;
|
|
103
|
+
exports.getRspackDefaultConfig = __webpack_exports__.getRspackDefaultConfig;
|
|
104
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
105
|
+
"createBuiltinCase",
|
|
106
|
+
"createCacheCase",
|
|
107
|
+
"createCompilerCase",
|
|
108
|
+
"createConfigCase",
|
|
109
|
+
"createDefaultsCase",
|
|
110
|
+
"createDevNormalCase",
|
|
111
|
+
"createDiagnosticCase",
|
|
112
|
+
"createErrorCase",
|
|
113
|
+
"createEsmOutputCase",
|
|
114
|
+
"createExampleCase",
|
|
115
|
+
"createHashCase",
|
|
116
|
+
"createHookCase",
|
|
117
|
+
"createHotCase",
|
|
118
|
+
"createHotIncrementalCase",
|
|
119
|
+
"createHotNormalCase",
|
|
120
|
+
"createHotStepCase",
|
|
121
|
+
"createMultiCompilerCase",
|
|
122
|
+
"createNativeWatcher",
|
|
123
|
+
"createNormalCase",
|
|
124
|
+
"createProdNormalCase",
|
|
125
|
+
"createSerialCase",
|
|
126
|
+
"createStatsAPICase",
|
|
127
|
+
"createStatsOutputCase",
|
|
128
|
+
"createTreeShakingCase",
|
|
129
|
+
"createWatchCase",
|
|
130
|
+
"createWatchIncrementalCase",
|
|
131
|
+
"getRspackDefaultConfig"
|
|
132
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
133
|
+
Object.defineProperty(exports, '__esModule', {
|
|
134
|
+
value: true
|
|
135
|
+
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { Compilation, Compiler, RspackOptions, Stats, StatsCompilation } from '@rspack/core';
|
|
2
|
-
import type { ITestContext } from '../type';
|
|
2
|
+
import type { ITestContext, MaybePromise } from '../type';
|
|
3
3
|
export declare function createMultiCompilerCase(name: string, src: string, dist: string, testConfig: string): void;
|
|
4
4
|
export type TMultiCompilerCaseConfig = {
|
|
5
5
|
description: string;
|
|
6
6
|
error?: boolean;
|
|
7
7
|
skip?: boolean;
|
|
8
8
|
options?: (context: ITestContext) => RspackOptions;
|
|
9
|
-
compiler?: (context: ITestContext, compiler: Compiler) =>
|
|
10
|
-
build?: (context: ITestContext, compiler: Compiler) =>
|
|
9
|
+
compiler?: (context: ITestContext, compiler: Compiler) => MaybePromise<void>;
|
|
10
|
+
build?: (context: ITestContext, compiler: Compiler) => MaybePromise<void>;
|
|
11
11
|
check?: ({ context, stats, files, compiler, compilation, }: {
|
|
12
12
|
context: ITestContext;
|
|
13
13
|
stats?: StatsCompilation;
|
|
14
14
|
files?: Record<string, string>;
|
|
15
15
|
compiler: Compiler;
|
|
16
16
|
compilation?: Compilation;
|
|
17
|
-
}) =>
|
|
17
|
+
}) => MaybePromise<void>;
|
|
18
18
|
compilerCallback?: (error: Error | null, stats: Stats | null) => void;
|
|
19
19
|
};
|
|
@@ -1,97 +1,122 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
createMultiCompilerCase: ()=>createMultiCompilerCase
|
|
37
|
+
});
|
|
38
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
39
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
40
|
+
const external_memfs_namespaceObject = require("memfs");
|
|
41
|
+
const creator_js_namespaceObject = require("../test/creator.js");
|
|
10
42
|
function createMultiCompilerProcessor(name, caseConfig) {
|
|
11
43
|
return {
|
|
12
|
-
config:
|
|
44
|
+
config: (context)=>{
|
|
13
45
|
const compiler = context.getCompiler();
|
|
14
46
|
const options = Object.assign([
|
|
15
47
|
{
|
|
16
48
|
name: 'a',
|
|
17
|
-
context:
|
|
18
|
-
entry: './a.js'
|
|
49
|
+
context: external_node_path_default().join(__dirname, 'fixtures'),
|
|
50
|
+
entry: './a.js'
|
|
19
51
|
},
|
|
20
52
|
{
|
|
21
53
|
name: 'b',
|
|
22
|
-
context:
|
|
23
|
-
entry: './b.js'
|
|
24
|
-
}
|
|
54
|
+
context: external_node_path_default().join(__dirname, 'fixtures'),
|
|
55
|
+
entry: './b.js'
|
|
56
|
+
}
|
|
25
57
|
], caseConfig.options?.(context) || {});
|
|
26
58
|
compiler.setOptions(options);
|
|
27
59
|
},
|
|
28
|
-
compiler: async (context)
|
|
60
|
+
compiler: async (context)=>{
|
|
29
61
|
const compiler = context.getCompiler();
|
|
30
|
-
if (caseConfig.compilerCallback)
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
compiler.createCompiler();
|
|
35
|
-
}
|
|
62
|
+
if (caseConfig.compilerCallback) compiler.createCompilerWithCallback(caseConfig.compilerCallback);
|
|
63
|
+
else compiler.createCompiler();
|
|
36
64
|
const c = compiler.getCompiler();
|
|
37
|
-
c.outputFileSystem = (0,
|
|
65
|
+
c.outputFileSystem = (0, external_memfs_namespaceObject.createFsFromVolume)(new external_memfs_namespaceObject.Volume());
|
|
38
66
|
c.watchFileSystem = {
|
|
39
|
-
watch() {
|
|
40
|
-
// watch should return a watcher instance
|
|
41
|
-
// watcher instance should have close, pause and getInfo methods
|
|
67
|
+
watch () {
|
|
42
68
|
return {
|
|
43
|
-
close: ()
|
|
44
|
-
pause: ()
|
|
45
|
-
getInfo: ()
|
|
46
|
-
return {
|
|
69
|
+
close: ()=>{},
|
|
70
|
+
pause: ()=>{},
|
|
71
|
+
getInfo: ()=>({
|
|
47
72
|
changes: new Set(),
|
|
48
73
|
removals: new Set(),
|
|
49
74
|
fileTimeInfoEntries: new Map(),
|
|
50
|
-
directoryTimeInfoEntries: new Map()
|
|
51
|
-
}
|
|
52
|
-
},
|
|
75
|
+
directoryTimeInfoEntries: new Map()
|
|
76
|
+
})
|
|
53
77
|
};
|
|
54
|
-
}
|
|
78
|
+
}
|
|
55
79
|
};
|
|
56
80
|
await caseConfig.compiler?.(context, c);
|
|
57
81
|
},
|
|
58
|
-
build: async (context)
|
|
82
|
+
build: async (context)=>{
|
|
59
83
|
const compiler = context.getCompiler();
|
|
60
|
-
if (typeof caseConfig.build
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
await compiler.build();
|
|
65
|
-
}
|
|
84
|
+
if ('function' == typeof caseConfig.build) await caseConfig.build?.(context, compiler.getCompiler());
|
|
85
|
+
else await compiler.build();
|
|
66
86
|
},
|
|
67
|
-
run: async (env, context)
|
|
68
|
-
check: async (env, context)
|
|
87
|
+
run: async (env, context)=>{},
|
|
88
|
+
check: async (env, context)=>{}
|
|
69
89
|
};
|
|
70
90
|
}
|
|
71
|
-
const creator = new
|
|
91
|
+
const creator = new creator_js_namespaceObject.BasicCaseCreator({
|
|
72
92
|
clean: true,
|
|
73
93
|
describe: false,
|
|
74
|
-
steps: ({ name, caseConfig })
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
concurrent: false,
|
|
94
|
+
steps: ({ name, caseConfig })=>[
|
|
95
|
+
createMultiCompilerProcessor(name, caseConfig)
|
|
96
|
+
],
|
|
97
|
+
concurrent: false
|
|
80
98
|
});
|
|
81
99
|
function createMultiCompilerCase(name, src, dist, testConfig) {
|
|
82
100
|
let caseConfigList = require(testConfig);
|
|
83
|
-
if (!Array.isArray(caseConfigList))
|
|
84
|
-
caseConfigList
|
|
85
|
-
|
|
86
|
-
for
|
|
101
|
+
if (!Array.isArray(caseConfigList)) caseConfigList = [
|
|
102
|
+
caseConfigList
|
|
103
|
+
];
|
|
104
|
+
for(let i = 0; i < caseConfigList.length; i++){
|
|
87
105
|
const caseConfig = caseConfigList[i];
|
|
88
106
|
if (caseConfig.skip) {
|
|
89
|
-
it.skip(`${name}[${i}]`, ()
|
|
107
|
+
it.skip(`${name}[${i}]`, ()=>{});
|
|
90
108
|
continue;
|
|
91
109
|
}
|
|
92
|
-
creator.create(`${name}[${i}]`, src, dist,
|
|
110
|
+
creator.create(`${name}[${i}]`, src, dist, void 0, {
|
|
93
111
|
caseConfig,
|
|
94
|
-
description: ()
|
|
112
|
+
description: ()=>caseConfig.description
|
|
95
113
|
});
|
|
96
114
|
}
|
|
97
115
|
}
|
|
116
|
+
exports.createMultiCompilerCase = __webpack_exports__.createMultiCompilerCase;
|
|
117
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
118
|
+
"createMultiCompilerCase"
|
|
119
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
120
|
+
Object.defineProperty(exports, '__esModule', {
|
|
121
|
+
value: true
|
|
122
|
+
});
|
|
@@ -1,42 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
createNativeWatcher: ()=>createNativeWatcher
|
|
37
|
+
});
|
|
38
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
39
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
40
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
41
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
42
|
+
const creator_js_namespaceObject = require("../test/creator.js");
|
|
43
|
+
const external_watch_js_namespaceObject = require("./watch.js");
|
|
44
|
+
const creator = new creator_js_namespaceObject.BasicCaseCreator({
|
|
12
45
|
clean: true,
|
|
13
46
|
runner: {
|
|
14
|
-
key:
|
|
15
|
-
runner:
|
|
16
|
-
},
|
|
17
|
-
description: (name, index) => {
|
|
18
|
-
return index === 0
|
|
19
|
-
? `${name} should compile`
|
|
20
|
-
: `should compile step ${index}`;
|
|
47
|
+
key: external_watch_js_namespaceObject.getWatchRunnerKey,
|
|
48
|
+
runner: external_watch_js_namespaceObject.createWatchRunner
|
|
21
49
|
},
|
|
50
|
+
description: (name, index)=>0 === index ? `${name} should compile` : `should compile step ${index}`,
|
|
22
51
|
describe: false,
|
|
23
|
-
steps: ({ name, src, temp })
|
|
52
|
+
steps: ({ name, src, temp })=>{
|
|
24
53
|
const watchState = {};
|
|
25
|
-
const runs =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
nativeWatcher: true,
|
|
33
|
-
})
|
|
34
|
-
: (0, watch_1.createWatchStepProcessor)(name, temp, run.name, watchState, {
|
|
35
|
-
nativeWatcher: true,
|
|
54
|
+
const runs = external_node_fs_default().readdirSync(src).sort().filter((name)=>external_node_fs_default().statSync(external_node_path_default().join(src, name)).isDirectory()).map((name)=>({
|
|
55
|
+
name
|
|
56
|
+
}));
|
|
57
|
+
return runs.map((run, index)=>0 === index ? (0, external_watch_js_namespaceObject.createWatchInitialProcessor)(name, temp, run.name, watchState, {
|
|
58
|
+
nativeWatcher: true
|
|
59
|
+
}) : (0, external_watch_js_namespaceObject.createWatchStepProcessor)(name, temp, run.name, watchState, {
|
|
60
|
+
nativeWatcher: true
|
|
36
61
|
}));
|
|
37
62
|
},
|
|
38
|
-
concurrent: true
|
|
63
|
+
concurrent: true
|
|
39
64
|
});
|
|
40
65
|
function createNativeWatcher(name, src, dist, temp) {
|
|
41
66
|
creator.create(name, src, dist, temp);
|
|
42
67
|
}
|
|
68
|
+
exports.createNativeWatcher = __webpack_exports__.createNativeWatcher;
|
|
69
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
70
|
+
"createNativeWatcher"
|
|
71
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
72
|
+
Object.defineProperty(exports, '__esModule', {
|
|
73
|
+
value: true
|
|
74
|
+
});
|