@rspack/test-tools 1.7.0-beta.0 → 1.7.0
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.d.ts +2 -2
- package/dist/case/builtin.js +58 -58
- package/dist/case/cache.d.ts +2 -2
- package/dist/case/cache.js +34 -34
- package/dist/case/common.d.ts +2 -2
- package/dist/case/common.js +45 -45
- package/dist/case/compiler.d.ts +3 -3
- package/dist/case/compiler.js +21 -21
- package/dist/case/config.d.ts +3 -3
- package/dist/case/config.js +19 -19
- package/dist/case/defaults.d.ts +2 -2
- package/dist/case/defaults.js +10 -10
- package/dist/case/diagnostic.js +29 -29
- package/dist/case/error.d.ts +2 -2
- package/dist/case/error.js +21 -21
- package/dist/case/esm-output.js +30 -26
- package/dist/case/example.js +7 -7
- package/dist/case/hash.d.ts +2 -2
- package/dist/case/hash.js +16 -16
- package/dist/case/hook.d.ts +3 -3
- package/dist/case/hook.js +42 -42
- package/dist/case/hot-step.d.ts +2 -2
- package/dist/case/hot-step.js +46 -46
- package/dist/case/hot.d.ts +5 -5
- package/dist/case/hot.js +43 -43
- package/dist/case/incremental.d.ts +2 -2
- package/dist/case/incremental.js +9 -9
- package/dist/case/index.d.ts +31 -31
- package/dist/case/multi-compiler.d.ts +3 -3
- package/dist/case/multi-compiler.js +15 -15
- package/dist/case/native-watcher.js +6 -6
- package/dist/case/normal.js +46 -46
- package/dist/case/runner.d.ts +2 -2
- package/dist/case/runner.js +22 -15
- package/dist/case/serial.d.ts +2 -2
- package/dist/case/serial.js +4 -4
- package/dist/case/stats-api.d.ts +2 -2
- package/dist/case/stats-api.js +7 -7
- package/dist/case/stats-output.d.ts +2 -2
- package/dist/case/stats-output.js +45 -45
- package/dist/case/treeshaking.js +6 -6
- package/dist/case/watch.d.ts +1 -1
- package/dist/case/watch.js +59 -59
- package/dist/compiler.d.ts +3 -3
- package/dist/compiler.js +31 -31
- package/dist/helper/directory.d.ts +1 -1
- package/dist/helper/directory.js +15 -15
- package/dist/helper/disable-iconv-lite-warning.js +3 -3
- package/dist/helper/expect/diff.js +8 -8
- package/dist/helper/expect/error.js +9 -9
- package/dist/helper/expect/placeholder.js +9 -9
- package/dist/helper/expect/rspack.js +5 -5
- package/dist/helper/expect/to-be-typeof.js +2 -2
- package/dist/helper/expect/to-end-with.js +3 -3
- package/dist/helper/expect/to-match-file-snapshot.d.ts +1 -1
- package/dist/helper/expect/to-match-file-snapshot.js +23 -23
- package/dist/helper/hot-update/index.d.ts +1 -1
- package/dist/helper/hot-update/loader.js +1 -1
- package/dist/helper/hot-update/plugin.d.ts +1 -1
- package/dist/helper/hot-update/plugin.js +15 -15
- package/dist/helper/index.d.ts +8 -8
- package/dist/helper/is.js +2 -2
- package/dist/helper/legacy/EventSourceForNode.js +8 -8
- package/dist/helper/legacy/LogTestPlugin.js +18 -18
- package/dist/helper/legacy/asModule.js +6 -6
- package/dist/helper/legacy/captureStdio.js +6 -6
- package/dist/helper/legacy/checkArrayExpectation.js +26 -23
- package/dist/helper/legacy/copyDiff.js +5 -5
- package/dist/helper/legacy/createFakeWorker.js +13 -13
- package/dist/helper/legacy/createLazyTestEnv.js +11 -11
- package/dist/helper/legacy/currentScript.js +1 -1
- package/dist/helper/legacy/deprecationTracking.js +13 -19
- package/dist/helper/legacy/expectSource.js +5 -5
- package/dist/helper/legacy/fakeSystem.js +14 -14
- package/dist/helper/legacy/findOutputFiles.js +4 -4
- package/dist/helper/legacy/parseResource.js +4 -4
- package/dist/helper/legacy/regexEscape.js +2 -2
- package/dist/helper/legacy/supportDefaultAssignment.js +2 -2
- package/dist/helper/legacy/supportsTextDecoder.js +2 -2
- package/dist/helper/legacy/supportsUsing.js +1 -1
- package/dist/helper/legacy/urlToRelativePath.js +3 -3
- package/dist/helper/parse-modules.js +13 -13
- package/dist/helper/read-config-file.d.ts +2 -2
- package/dist/helper/read-config-file.js +3 -3
- package/dist/helper/serializers.d.ts +1 -1
- package/dist/helper/serializers.js +11 -11
- package/dist/helper/setup-env.js +17 -17
- package/dist/helper/setup-expect.js +1 -1
- package/dist/helper/setup-wasm.js +4 -4
- package/dist/helper/stringify-config.d.ts +1 -1
- package/dist/helper/stringify-config.js +3 -3
- package/dist/helper/update-snapshot.js +1 -1
- package/dist/helper/util/checkSourceMap.js +16 -17
- package/dist/helper/util/checkStats.js +3 -3
- package/dist/helper/util/expectWarningFactory.js +2 -2
- package/dist/helper/util/filterUtil.js +9 -9
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/lazy-compilation-test-plugin.d.ts +1 -1
- package/dist/plugin/lazy-compilation-test-plugin.js +13 -13
- package/dist/runner/index.d.ts +2 -2
- package/dist/runner/node/index.d.ts +2 -2
- package/dist/runner/node/index.js +75 -74
- package/dist/runner/web/index.d.ts +2 -2
- package/dist/runner/web/index.js +45 -45
- package/dist/test/context.d.ts +2 -2
- package/dist/test/context.js +4 -4
- package/dist/test/creator.d.ts +1 -1
- package/dist/test/creator.js +28 -28
- package/dist/test/debug.d.ts +1 -1
- package/dist/test/debug.js +31 -31
- package/dist/test/tester.d.ts +1 -1
- package/dist/test/tester.js +11 -11
- package/dist/type.d.ts +3 -3
- package/package.json +7 -7
- package/rstest.d.ts +12 -12
package/dist/test/tester.js
CHANGED
|
@@ -35,7 +35,7 @@ class Tester {
|
|
|
35
35
|
fs_extra_1.default.mkdirSync(tempDir, { recursive: true });
|
|
36
36
|
}
|
|
37
37
|
for (const i of this.steps) {
|
|
38
|
-
if (typeof i.beforeAll ===
|
|
38
|
+
if (typeof i.beforeAll === 'function') {
|
|
39
39
|
await i.beforeAll(this.context);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -45,23 +45,23 @@ class Tester {
|
|
|
45
45
|
if (!currentStep)
|
|
46
46
|
return;
|
|
47
47
|
await this.runStepMethods(currentStep, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
'before',
|
|
49
|
+
'config',
|
|
50
|
+
'compiler',
|
|
51
|
+
'build',
|
|
52
52
|
]);
|
|
53
53
|
}
|
|
54
54
|
async check(env) {
|
|
55
55
|
const currentStep = this.steps[this.step];
|
|
56
56
|
if (!currentStep)
|
|
57
57
|
return;
|
|
58
|
-
await this.runCheckStepMethods(currentStep, env, this.context.hasError() ? [
|
|
58
|
+
await this.runCheckStepMethods(currentStep, env, this.context.hasError() ? ['check'] : ['run', 'check']);
|
|
59
59
|
}
|
|
60
60
|
async after() {
|
|
61
61
|
const currentStep = this.steps[this.step];
|
|
62
62
|
if (!currentStep)
|
|
63
63
|
return;
|
|
64
|
-
await this.runStepMethods(currentStep, [
|
|
64
|
+
await this.runStepMethods(currentStep, ['after'], true);
|
|
65
65
|
}
|
|
66
66
|
next() {
|
|
67
67
|
if (this.context.hasError()) {
|
|
@@ -75,7 +75,7 @@ class Tester {
|
|
|
75
75
|
}
|
|
76
76
|
async resume() {
|
|
77
77
|
for (const i of this.steps) {
|
|
78
|
-
if (typeof i.afterAll ===
|
|
78
|
+
if (typeof i.afterAll === 'function') {
|
|
79
79
|
await i.afterAll(this.context);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -98,7 +98,7 @@ class Tester {
|
|
|
98
98
|
for (const i of methods) {
|
|
99
99
|
if (!force && this.context.hasError())
|
|
100
100
|
return;
|
|
101
|
-
if (typeof step[i] ===
|
|
101
|
+
if (typeof step[i] === 'function') {
|
|
102
102
|
try {
|
|
103
103
|
await step[i](this.context);
|
|
104
104
|
}
|
|
@@ -111,14 +111,14 @@ class Tester {
|
|
|
111
111
|
async runCheckStepMethods(step, env, methods) {
|
|
112
112
|
try {
|
|
113
113
|
for (const i of methods) {
|
|
114
|
-
if (typeof step[i] ===
|
|
114
|
+
if (typeof step[i] === 'function') {
|
|
115
115
|
await step[i](env, this.context);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
catch (e) {
|
|
120
120
|
const errors = this.context.getError();
|
|
121
|
-
console.error(new Error([...errors, e].map(e => e.message).join(
|
|
121
|
+
console.error(new Error([...errors, e].map((e) => e.message).join('\n')));
|
|
122
122
|
throw e;
|
|
123
123
|
}
|
|
124
124
|
}
|
package/dist/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type EventEmitter from
|
|
2
|
-
import type { Compiler, MultiStats, RspackOptions, Stats, StatsCompilation } from
|
|
1
|
+
import type EventEmitter from 'node:events';
|
|
2
|
+
import type { Compiler, MultiStats, RspackOptions, Stats, StatsCompilation } from '@rspack/core';
|
|
3
3
|
export interface ITestContext {
|
|
4
4
|
getSource(sub?: string): string;
|
|
5
5
|
getDist(sub?: string): string;
|
|
@@ -98,7 +98,7 @@ export type TFileCompareResult = TCompareResult & {
|
|
|
98
98
|
source: string;
|
|
99
99
|
dist: string;
|
|
100
100
|
};
|
|
101
|
-
modules: Partial<Record<
|
|
101
|
+
modules: Partial<Record<'modules' | 'runtimeModules', TModuleCompareResult[]>>;
|
|
102
102
|
};
|
|
103
103
|
export type TDiffStatsItem = {
|
|
104
104
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/test-tools",
|
|
3
|
-
"version": "1.7.0
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"@babel/types": "7.28.5",
|
|
42
42
|
"cross-env": "^10.1.0",
|
|
43
43
|
"filenamify": "4.3.0",
|
|
44
|
-
"fs-extra": "^11.3.
|
|
45
|
-
"iconv-lite": "^0.7.
|
|
44
|
+
"fs-extra": "^11.3.3",
|
|
45
|
+
"iconv-lite": "^0.7.1",
|
|
46
46
|
"javascript-stringify": "^2.1.0",
|
|
47
|
-
"jest-diff": "^
|
|
47
|
+
"jest-diff": "^30.2.0",
|
|
48
48
|
"jest-snapshot": "29.7.0",
|
|
49
49
|
"jsdom": "^26.1.0",
|
|
50
50
|
"memfs": "4.51.1",
|
|
51
51
|
"path-serializer": "0.5.1",
|
|
52
|
-
"pretty-format": "
|
|
52
|
+
"pretty-format": "30.2.0",
|
|
53
53
|
"rimraf": "^5.0.10",
|
|
54
54
|
"source-map": "^0.7.6",
|
|
55
|
-
"terser-webpack-plugin": "^5.3.
|
|
55
|
+
"terser-webpack-plugin": "^5.3.16",
|
|
56
56
|
"webpack": "5.102.1",
|
|
57
57
|
"webpack-merge": "6.0.1",
|
|
58
58
|
"webpack-sources": "3.3.3",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/jsdom": "^21.1.7",
|
|
66
66
|
"typescript": "^5.9.3",
|
|
67
67
|
"wast-loader": "^1.14.1",
|
|
68
|
-
"@rspack/core": "1.7.0
|
|
68
|
+
"@rspack/core": "1.7.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@rspack/core": ">=1.0.0"
|
package/rstest.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/// <reference types="@rstest/core/globals" />
|
|
2
2
|
|
|
3
|
-
import type { DiffOptions } from
|
|
3
|
+
import type { DiffOptions } from 'jest-diff';
|
|
4
4
|
|
|
5
5
|
declare interface FileMatcherOptions {
|
|
6
|
-
|
|
6
|
+
diff?: DiffOptions;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
declare module
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
declare module '@rstest/core' {
|
|
10
|
+
interface Assertion {
|
|
11
|
+
toMatchFileSnapshotSync: (
|
|
12
|
+
filename?: string,
|
|
13
|
+
options?: FileMatcherOptions,
|
|
14
|
+
) => void;
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
declare global {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
type Expect = import('@rstest/core').Expect;
|
|
20
|
+
type Describe = import('@rstest/core').Describe;
|
|
21
|
+
type Assertion<T> = import('@rstest/core').Assertion<T>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export {};
|