@rspack/test-tools 1.0.13 → 1.0.14
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 +1 -2
- package/dist/case/compiler.js +1 -2
- package/dist/case/config.js +1 -2
- package/dist/case/defaults.js +1 -2
- package/dist/case/diagnostic.js +1 -2
- package/dist/case/diff.js +1 -2
- package/dist/case/error.js +1 -3
- package/dist/case/hash.js +1 -2
- package/dist/case/hook.js +1 -2
- package/dist/case/hot-step.js +1 -2
- package/dist/case/hot.js +1 -2
- package/dist/case/new-incremental.js +3 -12
- package/dist/case/normal.js +2 -3
- package/dist/case/stats-api.js +1 -3
- package/dist/case/stats-output.js +1 -2
- package/dist/case/treeshaking.js +1 -2
- package/dist/case/watch.js +1 -2
- package/dist/compare/compare.js +3 -4
- package/dist/compare/format-code.js +1 -2
- package/dist/compare/replace-module-argument.js +1 -2
- package/dist/compare/replace-runtime-module-name.js +2 -3
- package/dist/compiler.d.ts +0 -1
- package/dist/compiler.js +1 -1
- package/dist/helper/directory.d.ts +0 -1
- package/dist/helper/directory.js +2 -2
- package/dist/helper/expect/char.d.ts +4 -0
- package/dist/helper/expect/char.js +25 -0
- package/dist/helper/expect/diff.d.ts +3 -0
- package/dist/helper/expect/diff.js +21 -0
- package/dist/helper/expect/error.d.ts +5 -0
- package/dist/helper/expect/error.js +51 -0
- package/dist/helper/expect/placeholder.d.ts +1 -0
- package/dist/helper/expect/placeholder.js +34 -0
- package/dist/helper/expect/rspack.d.ts +3 -0
- package/dist/helper/expect/rspack.js +14 -0
- package/dist/helper/expect/to-be-typeof.js +1 -2
- package/dist/helper/expect/to-end-with.js +1 -2
- package/dist/helper/expect/to-match-file-snapshot.d.ts +0 -1
- package/dist/helper/expect/to-match-file-snapshot.js +1 -2
- package/dist/helper/legacy/EventSourceForNode.d.ts +2 -3
- package/dist/helper/legacy/FakeDocument.d.ts +2 -2
- package/dist/helper/legacy/asModule.d.ts +0 -1
- package/dist/helper/legacy/createFakeWorker.d.ts +0 -1
- package/dist/helper/legacy/fakeSystem.d.ts +3 -3
- package/dist/helper/legacy/walkCssTokens.d.ts +5 -3
- package/dist/helper/parse-modules.js +1 -2
- package/dist/helper/read-config-file.js +1 -2
- package/dist/helper/replace-paths.js +1 -2
- package/dist/helper/setup-env.d.ts +1 -0
- package/dist/helper/setup-env.js +1 -0
- package/dist/helper/setup-expect.js +58 -1
- package/dist/helper/update-snapshot.js +1 -2
- package/dist/helper/util/checkSourceMap.js +1 -1
- package/dist/helper/util/filterUtil.d.ts +4 -4
- package/dist/helper/util/identifier.d.ts +9 -9
- package/dist/helper/win.js +2 -3
- package/dist/processor/defaults.d.ts +2 -5
- package/dist/processor/defaults.js +2 -36
- package/dist/processor/error.d.ts +4 -6
- package/dist/processor/error.js +5 -66
- package/dist/processor/hook.d.ts +0 -1
- package/dist/processor/hot-new-incremental.js +1 -9
- package/dist/processor/stats-api.d.ts +0 -3
- package/dist/processor/stats-api.js +0 -4
- package/dist/processor/stats.js +7 -28
- package/dist/processor/watch.js +39 -1
- package/dist/runner/type.d.ts +0 -2
- package/dist/runner/type.js +1 -1
- package/dist/test/simple.js +1 -2
- package/dist/type.d.ts +0 -3
- package/dist/type.js +3 -3
- package/package.json +5 -4
package/dist/processor/watch.js
CHANGED
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const webpack_merge_1 = require("webpack-merge");
|
|
10
10
|
const compiler_1 = require("../compiler");
|
|
11
11
|
const helper_1 = require("../helper");
|
|
12
|
+
const checkArrayExpectation_1 = __importDefault(require("../helper/legacy/checkArrayExpectation"));
|
|
12
13
|
const copyDiff_1 = __importDefault(require("../helper/legacy/copyDiff"));
|
|
13
14
|
const multi_1 = require("./multi");
|
|
14
15
|
// This file is used to port step number to rspack.config.js/webpack.config.js
|
|
@@ -52,7 +53,44 @@ class WatchProcessor extends multi_1.MultiTaskProcessor {
|
|
|
52
53
|
await super.run(env, context);
|
|
53
54
|
}
|
|
54
55
|
async check(env, context) {
|
|
55
|
-
|
|
56
|
+
const testConfig = context.getTestConfig();
|
|
57
|
+
if (testConfig.noTest)
|
|
58
|
+
return;
|
|
59
|
+
const errors = (context.getError(this._options.name) || []).map(e => ({
|
|
60
|
+
message: e.message,
|
|
61
|
+
stack: e.stack
|
|
62
|
+
}));
|
|
63
|
+
const warnings = [];
|
|
64
|
+
const compiler = this.getCompiler(context);
|
|
65
|
+
const stats = compiler.getStats();
|
|
66
|
+
if (stats) {
|
|
67
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
|
|
68
|
+
preset: "verbose",
|
|
69
|
+
colors: false
|
|
70
|
+
}), "utf-8");
|
|
71
|
+
const jsonStats = stats.toJson({
|
|
72
|
+
errorDetails: true
|
|
73
|
+
});
|
|
74
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.json"), JSON.stringify(jsonStats, null, 2), "utf-8");
|
|
75
|
+
if (jsonStats.errors) {
|
|
76
|
+
errors.push(...jsonStats.errors);
|
|
77
|
+
}
|
|
78
|
+
if (jsonStats.warnings) {
|
|
79
|
+
warnings.push(...jsonStats.warnings);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
await new Promise((resolve, reject) => {
|
|
83
|
+
(0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { errors }, "error", "Error", reject);
|
|
84
|
+
resolve();
|
|
85
|
+
});
|
|
86
|
+
await new Promise((resolve, reject) => {
|
|
87
|
+
(0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { warnings }, "warning", "Warning", reject);
|
|
88
|
+
resolve();
|
|
89
|
+
});
|
|
90
|
+
// clear error if checked
|
|
91
|
+
if (node_fs_1.default.existsSync(context.getSource("errors.js"))) {
|
|
92
|
+
context.clearError(this._options.name);
|
|
93
|
+
}
|
|
56
94
|
// check hash
|
|
57
95
|
node_fs_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.txt"), node_path_1.default.join(context.getDist(), `stats.${this._watchOptions.stepName}.txt`));
|
|
58
96
|
node_fs_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.json"), node_path_1.default.join(context.getDist(), `stats.${this._watchOptions.stepName}.json`));
|
package/dist/runner/type.d.ts
CHANGED
package/dist/runner/type.js
CHANGED
|
@@ -6,4 +6,4 @@ var EEsmMode;
|
|
|
6
6
|
EEsmMode[EEsmMode["Unknown"] = 0] = "Unknown";
|
|
7
7
|
EEsmMode[EEsmMode["Evaluated"] = 1] = "Evaluated";
|
|
8
8
|
EEsmMode[EEsmMode["Unlinked"] = 2] = "Unlinked";
|
|
9
|
-
})(EEsmMode
|
|
9
|
+
})(EEsmMode || (exports.EEsmMode = EEsmMode = {}));
|
package/dist/test/simple.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSimpleProcessorRunner =
|
|
3
|
+
exports.getSimpleProcessorRunner = getSimpleProcessorRunner;
|
|
4
4
|
const context_1 = require("./context");
|
|
5
5
|
const CONTEXT_MAP = new Map();
|
|
6
6
|
function getSimpleProcessorRunner(src, dist, options = {}) {
|
|
@@ -41,4 +41,3 @@ function getSimpleProcessorRunner(src, dist, options = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
return CONTEXT_MAP.get(key);
|
|
43
43
|
}
|
|
44
|
-
exports.getSimpleProcessorRunner = getSimpleProcessorRunner;
|
package/dist/type.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="jest" />
|
|
3
|
-
/// <reference types="../jest.d.ts" />
|
|
4
1
|
import type EventEmitter from "node:events";
|
|
5
2
|
import type { Compiler as RspackCompiler, RspackOptions, Stats as RspackStats, StatsCompilation as RspackStatsCompilation } from "@rspack/core";
|
|
6
3
|
import type { Compiler as WebpackCompiler, Configuration as WebpackOptions, Stats as WebpackStats, StatsCompilation as WebpackStatsCompilation } from "webpack";
|
package/dist/type.js
CHANGED
|
@@ -6,7 +6,7 @@ var ECompilerType;
|
|
|
6
6
|
(function (ECompilerType) {
|
|
7
7
|
ECompilerType["Rspack"] = "rspack";
|
|
8
8
|
ECompilerType["Webpack"] = "webpack";
|
|
9
|
-
})(ECompilerType
|
|
9
|
+
})(ECompilerType || (exports.ECompilerType = ECompilerType = {}));
|
|
10
10
|
var ECompareResultType;
|
|
11
11
|
(function (ECompareResultType) {
|
|
12
12
|
ECompareResultType["Same"] = "same";
|
|
@@ -14,9 +14,9 @@ var ECompareResultType;
|
|
|
14
14
|
ECompareResultType["OnlyDist"] = "only-dist";
|
|
15
15
|
ECompareResultType["OnlySource"] = "only-source";
|
|
16
16
|
ECompareResultType["Different"] = "different";
|
|
17
|
-
})(ECompareResultType
|
|
17
|
+
})(ECompareResultType || (exports.ECompareResultType = ECompareResultType = {}));
|
|
18
18
|
var EDocumentType;
|
|
19
19
|
(function (EDocumentType) {
|
|
20
20
|
EDocumentType["Fake"] = "fake";
|
|
21
21
|
EDocumentType["JSDOM"] = "jsdom";
|
|
22
|
-
})(EDocumentType
|
|
22
|
+
})(EDocumentType || (exports.EDocumentType = EDocumentType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/test-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"jsdom": "^25.0.0",
|
|
49
49
|
"memfs": "4.8.1",
|
|
50
50
|
"mkdirp": "0.5.6",
|
|
51
|
+
"path-serializer": "0.1.2",
|
|
51
52
|
"pretty-format": "29.7.0",
|
|
52
53
|
"rimraf": "3.0.2",
|
|
53
54
|
"strip-ansi": "6.0.1",
|
|
@@ -99,10 +100,10 @@
|
|
|
99
100
|
"source-map-loader": "^5.0.0",
|
|
100
101
|
"style-loader": "^4.0.0",
|
|
101
102
|
"terser": "5.27.2",
|
|
102
|
-
"typescript": "5.
|
|
103
|
+
"typescript": "^5.6.3",
|
|
103
104
|
"wast-loader": "^1.12.1",
|
|
104
|
-
"@rspack/
|
|
105
|
-
"@rspack/
|
|
105
|
+
"@rspack/cli": "1.0.14",
|
|
106
|
+
"@rspack/core": "1.0.14"
|
|
106
107
|
},
|
|
107
108
|
"peerDependencies": {
|
|
108
109
|
"@rspack/core": ">=0.7.0"
|