@rspack/test-tools 1.4.7 → 1.4.9
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/index.d.ts +4 -4
- package/dist/case/index.js +4 -4
- package/dist/case/nativeWatcher.js +2 -2
- package/dist/compare/compare.js +1 -1
- package/dist/helper/index.d.ts +2 -2
- package/dist/helper/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/lazy-compilation-test-plugin.js +1 -2
- package/dist/plugin/webpack-module-placeholder-plugin.js +0 -1
- package/dist/processor/hook.d.ts +1 -1
- package/dist/processor/hook.js +1 -1
- package/dist/processor/index.d.ts +1 -1
- package/dist/processor/index.js +1 -1
- package/dist/processor/watch.js +5 -1
- package/dist/runner/index.d.ts +1 -1
- package/dist/runner/index.js +1 -1
- package/dist/runner/runner/web/fake.js +2 -2
- package/dist/runner/runner/web/jsdom.js +1 -1
- package/dist/test/context.d.ts +1 -1
- package/dist/test/creator.d.ts +1 -1
- package/dist/test/creator.js +3 -3
- package/package.json +6 -6
- package/template/editor.worker.js +1 -1
package/dist/case/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./builtin";
|
|
2
|
+
export * from "./cache";
|
|
2
3
|
export * from "./compiler";
|
|
3
4
|
export * from "./config";
|
|
4
5
|
export * from "./defaults";
|
|
@@ -9,12 +10,11 @@ export * from "./hash";
|
|
|
9
10
|
export * from "./hook";
|
|
10
11
|
export * from "./hot";
|
|
11
12
|
export * from "./hot-step";
|
|
13
|
+
export * from "./incremental";
|
|
14
|
+
export * from "./nativeWatcher";
|
|
12
15
|
export * from "./normal";
|
|
16
|
+
export * from "./serial";
|
|
13
17
|
export * from "./stats-api";
|
|
14
18
|
export * from "./stats-output";
|
|
15
19
|
export * from "./treeshaking";
|
|
16
20
|
export * from "./watch";
|
|
17
|
-
export * from "./incremental";
|
|
18
|
-
export * from "./cache";
|
|
19
|
-
export * from "./serial";
|
|
20
|
-
export * from "./nativeWatcher";
|
package/dist/case/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./builtin"), exports);
|
|
18
|
+
__exportStar(require("./cache"), exports);
|
|
18
19
|
__exportStar(require("./compiler"), exports);
|
|
19
20
|
__exportStar(require("./config"), exports);
|
|
20
21
|
__exportStar(require("./defaults"), exports);
|
|
@@ -25,12 +26,11 @@ __exportStar(require("./hash"), exports);
|
|
|
25
26
|
__exportStar(require("./hook"), exports);
|
|
26
27
|
__exportStar(require("./hot"), exports);
|
|
27
28
|
__exportStar(require("./hot-step"), exports);
|
|
29
|
+
__exportStar(require("./incremental"), exports);
|
|
30
|
+
__exportStar(require("./nativeWatcher"), exports);
|
|
28
31
|
__exportStar(require("./normal"), exports);
|
|
32
|
+
__exportStar(require("./serial"), exports);
|
|
29
33
|
__exportStar(require("./stats-api"), exports);
|
|
30
34
|
__exportStar(require("./stats-output"), exports);
|
|
31
35
|
__exportStar(require("./treeshaking"), exports);
|
|
32
36
|
__exportStar(require("./watch"), exports);
|
|
33
|
-
__exportStar(require("./incremental"), exports);
|
|
34
|
-
__exportStar(require("./cache"), exports);
|
|
35
|
-
__exportStar(require("./serial"), exports);
|
|
36
|
-
__exportStar(require("./nativeWatcher"), exports);
|
|
@@ -47,8 +47,8 @@ const creator = new creator_1.BasicCaseCreator({
|
|
|
47
47
|
configFiles: ["rspack.config.js", "webpack.config.js"]
|
|
48
48
|
}, watchState));
|
|
49
49
|
},
|
|
50
|
-
// TODO:
|
|
51
|
-
concurrent:
|
|
50
|
+
// TODO: support more concurrency
|
|
51
|
+
concurrent: 4
|
|
52
52
|
});
|
|
53
53
|
function createNativeWatcher(name, src, dist, temp) {
|
|
54
54
|
creator.create(name, src, dist, temp);
|
package/dist/compare/compare.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.compareFile = compareFile;
|
|
7
7
|
exports.compareModules = compareModules;
|
|
8
8
|
exports.compareContent = compareContent;
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
10
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
11
|
const jest_diff_1 = require("jest-diff");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
12
|
const helper_1 = require("../helper");
|
|
13
13
|
const type_1 = require("../type");
|
|
14
14
|
const format_code_1 = require("./format-code");
|
package/dist/helper/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./directory";
|
|
2
|
+
export * from "./legacy/supportsImportFn";
|
|
2
3
|
export * from "./parse-modules";
|
|
3
4
|
export * from "./read-config-file";
|
|
4
5
|
export * from "./update-snapshot";
|
|
5
|
-
export * from "./win";
|
|
6
6
|
export * from "./util/checkStats";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./win";
|
package/dist/helper/index.js
CHANGED
|
@@ -15,9 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./directory"), exports);
|
|
18
|
+
__exportStar(require("./legacy/supportsImportFn"), exports);
|
|
18
19
|
__exportStar(require("./parse-modules"), exports);
|
|
19
20
|
__exportStar(require("./read-config-file"), exports);
|
|
20
21
|
__exportStar(require("./update-snapshot"), exports);
|
|
21
|
-
__exportStar(require("./win"), exports);
|
|
22
22
|
__exportStar(require("./util/checkStats"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./win"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from "./processor";
|
|
|
6
6
|
export * from "./reporter";
|
|
7
7
|
export * from "./runner";
|
|
8
8
|
export * from "./test/context";
|
|
9
|
+
export * from "./test/creator";
|
|
9
10
|
export * from "./test/simple";
|
|
10
11
|
export * from "./test/tester";
|
|
11
|
-
export * from "./test/creator";
|
|
12
12
|
export * from "./type";
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ __exportStar(require("./processor"), exports);
|
|
|
22
22
|
__exportStar(require("./reporter"), exports);
|
|
23
23
|
__exportStar(require("./runner"), exports);
|
|
24
24
|
__exportStar(require("./test/context"), exports);
|
|
25
|
+
__exportStar(require("./test/creator"), exports);
|
|
25
26
|
__exportStar(require("./test/simple"), exports);
|
|
26
27
|
__exportStar(require("./test/tester"), exports);
|
|
27
|
-
__exportStar(require("./test/creator"), exports);
|
|
28
28
|
__exportStar(require("./type"), exports);
|
package/dist/plugin/index.d.ts
CHANGED
package/dist/plugin/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./lazy-compilation-test-plugin"), exports);
|
|
17
18
|
__exportStar(require("./rspack-diff-config-plugin"), exports);
|
|
18
19
|
__exportStar(require("./webpack-diff-config-plugin"), exports);
|
|
19
20
|
__exportStar(require("./webpack-module-placeholder-plugin"), exports);
|
|
20
|
-
__exportStar(require("./lazy-compilation-test-plugin"), exports);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LazyCompilationTestPlugin = void 0;
|
|
4
4
|
const node_http_1 = require("node:http");
|
|
5
5
|
const core_1 = require("@rspack/core");
|
|
6
|
-
const core_2 = require("@rspack/core");
|
|
7
6
|
class LazyCompilationTestPlugin {
|
|
8
7
|
apply(compiler) {
|
|
9
8
|
let middleware;
|
|
@@ -30,7 +29,7 @@ class LazyCompilationTestPlugin {
|
|
|
30
29
|
else if (compiler.options.experiments.lazyCompilation) {
|
|
31
30
|
compiler.options.experiments.lazyCompilation.serverUrl = urlBase;
|
|
32
31
|
}
|
|
33
|
-
middleware =
|
|
32
|
+
middleware = core_1.experiments.lazyCompilationMiddleware(compiler);
|
|
34
33
|
resolve(null);
|
|
35
34
|
});
|
|
36
35
|
server.on("request", (req, res) => {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WebpackModulePlaceholderPlugin = void 0;
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
const { ConcatSource, RawSource, CachedSource, PrefixSource } = require("webpack-sources");
|
|
6
|
-
const path = require("node:path");
|
|
7
6
|
function createRenderRuntimeModulesFn(Template) {
|
|
8
7
|
return function renderRuntimeModules(runtimeModules, renderContext) {
|
|
9
8
|
const source = new ConcatSource();
|
package/dist/processor/hook.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TTestContextOptions
|
|
1
|
+
import { TestContext, type TTestContextOptions } from "../test/context";
|
|
2
2
|
import type { ECompilerType, ITestContext, ITestEnv, TCompiler, TCompilerOptions } from "../type";
|
|
3
3
|
import { type ISnapshotProcessorOptions, SnapshotProcessor } from "./snapshot";
|
|
4
4
|
export declare class HookCasesContext extends TestContext {
|
package/dist/processor/hook.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.HookTaskProcessor = exports.HookCasesContext = void 0;
|
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const core_1 = require("@rspack/core");
|
|
9
9
|
const jest_snapshot_1 = require("jest-snapshot");
|
|
10
|
-
const pretty_format_1 = require("pretty-format");
|
|
11
10
|
const path_serializer_1 = require("path-serializer");
|
|
11
|
+
const pretty_format_1 = require("pretty-format");
|
|
12
12
|
const context_1 = require("../test/context");
|
|
13
13
|
const snapshot_1 = require("./snapshot");
|
|
14
14
|
const srcDir = node_path_1.default.resolve(__dirname, "../../tests/fixtures");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./basic";
|
|
2
2
|
export * from "./builtin";
|
|
3
|
+
export * from "./cache";
|
|
3
4
|
export * from "./config";
|
|
4
5
|
export * from "./defaults";
|
|
5
6
|
export * from "./diagnostic";
|
|
@@ -17,4 +18,3 @@ export * from "./snapshot";
|
|
|
17
18
|
export * from "./stats";
|
|
18
19
|
export * from "./stats-api";
|
|
19
20
|
export * from "./watch";
|
|
20
|
-
export * from "./cache";
|
package/dist/processor/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./basic"), exports);
|
|
18
18
|
__exportStar(require("./builtin"), exports);
|
|
19
|
+
__exportStar(require("./cache"), exports);
|
|
19
20
|
__exportStar(require("./config"), exports);
|
|
20
21
|
__exportStar(require("./defaults"), exports);
|
|
21
22
|
__exportStar(require("./diagnostic"), exports);
|
|
@@ -33,4 +34,3 @@ __exportStar(require("./snapshot"), exports);
|
|
|
33
34
|
__exportStar(require("./stats"), exports);
|
|
34
35
|
__exportStar(require("./stats-api"), exports);
|
|
35
36
|
__exportStar(require("./watch"), exports);
|
|
36
|
-
__exportStar(require("./cache"), exports);
|
package/dist/processor/watch.js
CHANGED
|
@@ -233,7 +233,11 @@ class WatchStepProcessor extends WatchProcessor {
|
|
|
233
233
|
});
|
|
234
234
|
});
|
|
235
235
|
// wait compiler to ready watch the files and diretories
|
|
236
|
-
|
|
236
|
+
// TODO: native watcher will call ignored js function in rust
|
|
237
|
+
// but it will block the watch step processor. Then, native watcher maybe spend more time.
|
|
238
|
+
// So we need to wait a while to ensure the files and directories are ready.
|
|
239
|
+
const timeout = this._watchOptions.nativeWatcher ? 500 : 100;
|
|
240
|
+
await new Promise(resolve => setTimeout(resolve, timeout));
|
|
237
241
|
(0, copyDiff_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), this._watchOptions.tempDir, false);
|
|
238
242
|
await task;
|
|
239
243
|
}
|
package/dist/runner/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./basic";
|
|
2
|
+
export * from "./cache";
|
|
2
3
|
export * from "./hot";
|
|
3
4
|
export * from "./hot-step";
|
|
4
5
|
export * from "./multiple";
|
|
@@ -6,4 +7,3 @@ export * from "./normal";
|
|
|
6
7
|
export * from "./runner";
|
|
7
8
|
export * from "./type";
|
|
8
9
|
export * from "./watch";
|
|
9
|
-
export * from "./cache";
|
package/dist/runner/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./basic"), exports);
|
|
18
|
+
__exportStar(require("./cache"), exports);
|
|
18
19
|
__exportStar(require("./hot"), exports);
|
|
19
20
|
__exportStar(require("./hot-step"), exports);
|
|
20
21
|
__exportStar(require("./multiple"), exports);
|
|
@@ -22,4 +23,3 @@ __exportStar(require("./normal"), exports);
|
|
|
22
23
|
__exportStar(require("./runner"), exports);
|
|
23
24
|
__exportStar(require("./type"), exports);
|
|
24
25
|
__exportStar(require("./watch"), exports);
|
|
25
|
-
__exportStar(require("./cache"), exports);
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FakeDocumentWebRunner = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const EventSourceForNode_1 = __importDefault(require("../../../helper/legacy/EventSourceForNode"));
|
|
10
|
-
const FakeDocument_1 = __importDefault(require("../../../helper/legacy/FakeDocument"));
|
|
11
9
|
const createFakeWorker_1 = __importDefault(require("../../../helper/legacy/createFakeWorker"));
|
|
12
10
|
const currentScript_1 = __importDefault(require("../../../helper/legacy/currentScript"));
|
|
11
|
+
const EventSourceForNode_1 = __importDefault(require("../../../helper/legacy/EventSourceForNode"));
|
|
12
|
+
const FakeDocument_1 = __importDefault(require("../../../helper/legacy/FakeDocument"));
|
|
13
13
|
const urlToRelativePath_1 = __importDefault(require("../../../helper/legacy/urlToRelativePath"));
|
|
14
14
|
const cjs_1 = require("../cjs");
|
|
15
15
|
class FakeDocumentWebRunner extends cjs_1.CommonJsRunner {
|
|
@@ -8,8 +8,8 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const jsdom_1 = require("jsdom");
|
|
10
10
|
const helper_1 = require("../../../helper");
|
|
11
|
-
const EventSourceForNode_1 = __importDefault(require("../../../helper/legacy/EventSourceForNode"));
|
|
12
11
|
const createFakeWorker_1 = __importDefault(require("../../../helper/legacy/createFakeWorker"));
|
|
12
|
+
const EventSourceForNode_1 = __importDefault(require("../../../helper/legacy/EventSourceForNode"));
|
|
13
13
|
const urlToRelativePath_1 = __importDefault(require("../../../helper/legacy/urlToRelativePath"));
|
|
14
14
|
const cjs_1 = require("../cjs");
|
|
15
15
|
// Compatibility code to suppress iconv-lite warnings
|
package/dist/test/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ECompilerType, ITestCompilerManager, ITestContext,
|
|
1
|
+
import type { ECompilerType, ITestCompilerManager, ITestContext, ITesterConfig, ITestRunner, TRunnerFactory, TTestConfig } from "../type";
|
|
2
2
|
export type TTestContextOptions = Omit<ITesterConfig, "name" | "steps">;
|
|
3
3
|
export declare class TestContext implements ITestContext {
|
|
4
4
|
private config;
|
package/dist/test/creator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ECompilerType, ITestContext, ITestEnv,
|
|
1
|
+
import type { ECompilerType, ITestContext, ITestEnv, ITester, ITestProcessor, TRunnerFactory, TTestConfig } from "../type";
|
|
2
2
|
declare global {
|
|
3
3
|
var testFilter: string | undefined;
|
|
4
4
|
}
|
package/dist/test/creator.js
CHANGED
|
@@ -85,7 +85,7 @@ class BasicCaseCreator {
|
|
|
85
85
|
let stepSignalResolve = null;
|
|
86
86
|
const stepSignal = new Promise((resolve, reject) => {
|
|
87
87
|
stepSignalResolve = resolve;
|
|
88
|
-
}).catch(
|
|
88
|
+
}).catch(() => {
|
|
89
89
|
// prevent unhandled rejection
|
|
90
90
|
});
|
|
91
91
|
const description = typeof this._options.description === "function"
|
|
@@ -118,14 +118,14 @@ class BasicCaseCreator {
|
|
|
118
118
|
stepSignalResolve(e);
|
|
119
119
|
return Promise.reject();
|
|
120
120
|
}
|
|
121
|
-
},
|
|
121
|
+
}, () => {
|
|
122
122
|
// bailout
|
|
123
123
|
stepSignalResolve();
|
|
124
124
|
return Promise.reject();
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
chain
|
|
128
|
-
.catch(
|
|
128
|
+
.catch(() => {
|
|
129
129
|
// bailout error
|
|
130
130
|
// prevent unhandled rejection
|
|
131
131
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/test-tools",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/generator": "7.28.0",
|
|
36
36
|
"@babel/parser": "7.28.0",
|
|
37
37
|
"@babel/traverse": "7.28.0",
|
|
38
|
-
"@babel/types": "7.28.
|
|
38
|
+
"@babel/types": "7.28.1",
|
|
39
39
|
"cross-env": "^7.0.3",
|
|
40
40
|
"csv-to-markdown-table": "^1.5.0",
|
|
41
41
|
"deepmerge": "^4.3.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"babel-loader": "^10.0.0",
|
|
75
75
|
"babel-plugin-import": "^1.13.8",
|
|
76
76
|
"chalk": "^4.1.2",
|
|
77
|
-
"core-js": "3.
|
|
77
|
+
"core-js": "3.44.0",
|
|
78
78
|
"css-loader": "^7.1.2",
|
|
79
79
|
"file-loader": "^6.2.0",
|
|
80
80
|
"graceful-fs": "^4.2.11",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
"typescript": "^5.8.3",
|
|
97
97
|
"wast-loader": "^1.14.1",
|
|
98
98
|
"worker-rspack-loader": "^3.1.2",
|
|
99
|
-
"@rspack/cli": "1.4.
|
|
100
|
-
"@rspack/
|
|
101
|
-
"@rspack/
|
|
99
|
+
"@rspack/cli": "1.4.9",
|
|
100
|
+
"@rspack/core": "1.4.9",
|
|
101
|
+
"@rspack/test-tools": "1.4.9",
|
|
102
102
|
"@rspack/binding-testing": "1.4.1"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|