@@ -20,8 +20,12 @@ import type { Stats } from '@rspack/core';
20
20
import type { Stats as Stats_2 } from ' webpack' ;
21
21
import type { StatsCompilation } from ' @rspack/core' ;
22
22
import type { StatsCompilation as StatsCompilation_2 } from ' webpack' ;
23
+ import type { StatsError } from ' @rspack/core' ;
23
24
import type { WebpackOptionsNormalized } from ' webpack' ;
24
25
26
+ // @public (undocumented)
27
+ export function basename(filename : string ): string ;
28
+
25
29
// @public (undocumented)
26
30
export class BasicCaseCreator <T extends ECompilerType > {
27
31
constructor (_options : IBasicCaseCreatorOptions <T >);
@@ -61,6 +65,9 @@ export class BasicCaseCreator<T extends ECompilerType> {
61
65
protected tryRunTask(concurrent ? : number ): void ;
62
66
}
63
67
68
+ // @public (undocumented)
69
+ export function casename(filename : string ): string ;
70
+
64
71
// @public (undocumented)
65
72
export function checkChunkModules(statsJson : any , chunkModulesMap : any , strict ? : boolean ): boolean ;
66
73
@@ -82,24 +89,15 @@ export function createBuiltinCase(name: string, src: string, dist: string): void
82
89
// @public (undocumented)
83
90
export function createCacheCase(name : string , src : string , dist : string , target : TCompilerOptions <ECompilerType .Rspack >[" target" ], temp : string ): void ;
84
91
85
- // @public (undocumented)
86
- export function createCompilerCase(name : string , src : string , dist : string , testConfig : string ): void ;
87
-
88
92
// @public (undocumented)
89
93
export function createConfigCase(name : string , src : string , dist : string ): void ;
90
94
91
- // @public (undocumented)
92
- export function createDefaultsCase(name : string , src : string ): void ;
93
-
94
95
// @public (undocumented)
95
96
export function createDiagnosticCase(name : string , src : string , dist : string ): void ;
96
97
97
98
// @public (undocumented)
98
99
export function createDiffCase(name : string , src : string , dist : string ): void ;
99
100
100
- // @public (undocumented)
101
- export function createErrorCase(name : string , src : string , dist : string , testConfig : string ): void ;
102
-
103
101
// @public (undocumented)
104
102
export function createHashCase(name : string , src : string , dist : string ): void ;
105
103
@@ -127,9 +125,6 @@ export function createNormalCase(name: string, src: string, dist: string): void;
127
125
// @public (undocumented)
128
126
export function createSerialCase(name : string , src : string , dist : string ): void ;
129
127
130
- // @public (undocumented)
131
- export function createStatsAPICase(name : string , src : string , dist : string , testConfig : string ): void ;
132
-
133
128
// @public (undocumented)
134
129
export function createStatsOutputCase(name : string , src : string , dist : string ): void ;
135
130
@@ -142,6 +137,18 @@ export function createWatchCase(name: string, src: string, dist: string, temp: s
142
137
// @public (undocumented)
143
138
export function createWatchIncrementalCase(name : string , src : string , dist : string , temp : string , options ? : WatchIncrementalOptions ): void ;
144
139
140
+ // @public (undocumented)
141
+ export function defineCompileCase(name : string , caseConfigList : TCompilerCaseConfig | TCompilerCaseConfig []): void ;
142
+
143
+ // @public (undocumented)
144
+ export function defineDefaultsCase(name : string , caseConfig : TDefaultsCaseConfig ): void ;
145
+
146
+ // @public (undocumented)
147
+ export function defineErrorCase(name : string , caseConfig : TErrorCaseConfig ): void ;
148
+
149
+ // @public (undocumented)
150
+ export function defineStatsAPICase(name : string , caseConfig : TStatsAPICaseConfig ): void ;
151
+
145
152
// @public (undocumented)
146
153
export function describeByWalk(testFile : string , createCase : (name : string , src : string , dist : string ) => void , options ? : {
147
154
type? : " file" | " directory" ;
@@ -233,7 +240,7 @@ export function escapeSep(str: string): string;
233
240
export function formatCode(name : string , raw : string , options : IFormatCodeOptions ): string ;
234
241
235
242
// @public (undocumented)
236
- export function getRspackDefaultConfig(cwd : string , config : TCompilerOptions <ECompilerType >): TCompilerOptions <ECompilerType >;
243
+ export function getRspackDefaultConfig(context : string , config : TCompilerOptions <ECompilerType >): TCompilerOptions <ECompilerType >;
237
244
238
245
// @public (undocumented)
239
246
export interface IBasicCaseCreatorOptions <T extends ECompilerType > {
@@ -672,6 +679,22 @@ export class RspackDiffConfigPlugin implements RspackPluginInstance {
672
679
name: string ;
673
680
}
674
681
682
+ // @public (undocumented)
683
+ class RspackStatsDiagnostics {
684
+ constructor (errors : StatsError [], warnings : StatsError []);
685
+ // (undocumented)
686
+ errors: StatsError [];
687
+ // (undocumented)
688
+ warnings: StatsError [];
689
+ }
690
+
691
+ // @public (undocumented)
692
+ class RspackTestDiff {
693
+ constructor (value : string );
694
+ // (undocumented)
695
+ value: string ;
696
+ }
697
+
675
698
// @public (undocumented)
676
699
export type TCaseSummary = Record <TCaseSummaryId , number >;
677
700
@@ -700,6 +723,24 @@ export type TCompilation<T> = T extends ECompilerType.Rspack ? Compilation : Com
700
723
// @public (undocumented)
701
724
export type TCompiler <T > = T extends ECompilerType .Rspack ? Compiler : Compiler_2 ;
702
725
726
+ // @public (undocumented)
727
+ type TCompilerCaseConfig = {
728
+ description: string ;
729
+ error? : boolean ;
730
+ skip? : boolean ;
731
+ options? : (context : ITestContext ) => TCompilerOptions <ECompilerType .Rspack >;
732
+ compiler? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
733
+ build? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
734
+ check? : ({ context, stats, files, compiler, compilation }: {
735
+ context: ITestContext ;
736
+ stats? : TCompilerStatsCompilation <ECompilerType .Rspack >;
737
+ files? : Record <string , string >;
738
+ compiler: TCompiler <ECompilerType .Rspack >;
739
+ compilation? : TCompilation <ECompilerType .Rspack >;
740
+ }) => Promise <void >;
741
+ compilerCallback? : (error : Error | null , stats : TCompilerStats <ECompilerType .Rspack > | null ) => void ;
742
+ };
743
+
703
744
// @public (undocumented)
704
745
export type TCompilerFactories <T extends ECompilerType > = Record <T , TCompilerFactory <T >>;
705
746
@@ -721,6 +762,14 @@ export type TCompilerStatsCompilation<T> = T extends ECompilerType.Rspack ? Stat
721
762
// @public (undocumented)
722
763
export type TCompilerTypeId = ECompilerType .Rspack | ECompilerType .Webpack | " common" ;
723
764
765
+ // @public (undocumented)
766
+ type TDefaultsCaseConfig = {
767
+ options? : (context : ITestContext ) => TCompilerOptions <ECompilerType .Rspack >;
768
+ cwd? : string ;
769
+ diff: (diff : jest .JestMatchers <RspackTestDiff >, defaults : jest .JestMatchers <TCompilerOptions <ECompilerType .Rspack >>) => Promise <void >;
770
+ description: string ;
771
+ };
772
+
724
773
// @public (undocumented)
725
774
export type TDiffStats = {
726
775
root: string ;
@@ -738,6 +787,15 @@ export type TDiffStatsItem = {
738
787
// @public (undocumented)
739
788
export type TDimenTypeId = " modules" | " lines" | " lines-in-common" ;
740
789
790
+ // @public (undocumented)
791
+ type TErrorCaseConfig = {
792
+ description: string ;
793
+ options? : (context : ITestContext ) => TCompilerOptions <ECompilerType .Rspack >;
794
+ compiler? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
795
+ build? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
796
+ check? : (stats : RspackStatsDiagnostics ) => Promise <void >;
797
+ };
798
+
741
799
// @public (undocumented)
742
800
export class TestContext implements ITestContext {
743
801
constructor (config : TTestContextOptions );
@@ -848,6 +906,16 @@ export type TRunnerRequirer = (currentDirectory: string, modulePath: string[] |
848
906
esmMode? : EEsmMode ;
849
907
}) => Object | Promise <Object >;
850
908
909
+ // @public (undocumented)
910
+ type TStatsAPICaseConfig = {
911
+ description: string ;
912
+ options? : (context : ITestContext ) => TCompilerOptions <ECompilerType .Rspack >;
913
+ snapshotName? : string ;
914
+ compiler? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
915
+ build? : (context : ITestContext , compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
916
+ check? : (stats : TCompilerStats <ECompilerType .Rspack >, compiler : TCompiler <ECompilerType .Rspack >) => Promise <void >;
917
+ };
918
+
851
919
// @public (undocumented)
852
920
export type TTestConfig <T extends ECompilerType > = {
853
921
documentType? : EDocumentType ;
0 commit comments