@@ -20,8 +20,12 @@ import type { Stats } from '@rspack/core';
2020import type { Stats as Stats_2 } from ' webpack' ;
2121import type { StatsCompilation } from ' @rspack/core' ;
2222import type { StatsCompilation as StatsCompilation_2 } from ' webpack' ;
23+ import type { StatsError } from ' @rspack/core' ;
2324import type { WebpackOptionsNormalized } from ' webpack' ;
2425
26+ // @public (undocumented)
27+ export function basename(filename : string ): string ;
28+
2529// @public (undocumented)
2630export class BasicCaseCreator <T extends ECompilerType > {
2731 constructor (_options : IBasicCaseCreatorOptions <T >);
@@ -61,6 +65,9 @@ export class BasicCaseCreator<T extends ECompilerType> {
6165 protected tryRunTask(concurrent ? : number ): void ;
6266}
6367
68+ // @public (undocumented)
69+ export function casename(filename : string ): string ;
70+
6471// @public (undocumented)
6572export function checkChunkModules(statsJson : any , chunkModulesMap : any , strict ? : boolean ): boolean ;
6673
@@ -82,24 +89,15 @@ export function createBuiltinCase(name: string, src: string, dist: string): void
8289// @public (undocumented)
8390export function createCacheCase(name : string , src : string , dist : string , target : TCompilerOptions <ECompilerType .Rspack >[" target" ], temp : string ): void ;
8491
85- // @public (undocumented)
86- export function createCompilerCase(name : string , src : string , dist : string , testConfig : string ): void ;
87-
8892// @public (undocumented)
8993export function createConfigCase(name : string , src : string , dist : string ): void ;
9094
91- // @public (undocumented)
92- export function createDefaultsCase(name : string , src : string ): void ;
93-
9495// @public (undocumented)
9596export function createDiagnosticCase(name : string , src : string , dist : string ): void ;
9697
9798// @public (undocumented)
9899export function createDiffCase(name : string , src : string , dist : string ): void ;
99100
100- // @public (undocumented)
101- export function createErrorCase(name : string , src : string , dist : string , testConfig : string ): void ;
102-
103101// @public (undocumented)
104102export function createHashCase(name : string , src : string , dist : string ): void ;
105103
@@ -127,9 +125,6 @@ export function createNormalCase(name: string, src: string, dist: string): void;
127125// @public (undocumented)
128126export function createSerialCase(name : string , src : string , dist : string ): void ;
129127
130- // @public (undocumented)
131- export function createStatsAPICase(name : string , src : string , dist : string , testConfig : string ): void ;
132-
133128// @public (undocumented)
134129export function createStatsOutputCase(name : string , src : string , dist : string ): void ;
135130
@@ -142,6 +137,18 @@ export function createWatchCase(name: string, src: string, dist: string, temp: s
142137// @public (undocumented)
143138export function createWatchIncrementalCase(name : string , src : string , dist : string , temp : string , options ? : WatchIncrementalOptions ): void ;
144139
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+
145152// @public (undocumented)
146153export function describeByWalk(testFile : string , createCase : (name : string , src : string , dist : string ) => void , options ? : {
147154 type? : " file" | " directory" ;
@@ -233,7 +240,7 @@ export function escapeSep(str: string): string;
233240export function formatCode(name : string , raw : string , options : IFormatCodeOptions ): string ;
234241
235242// @public (undocumented)
236- export function getRspackDefaultConfig(cwd : string , config : TCompilerOptions <ECompilerType >): TCompilerOptions <ECompilerType >;
243+ export function getRspackDefaultConfig(context : string , config : TCompilerOptions <ECompilerType >): TCompilerOptions <ECompilerType >;
237244
238245// @public (undocumented)
239246export interface IBasicCaseCreatorOptions <T extends ECompilerType > {
@@ -672,6 +679,22 @@ export class RspackDiffConfigPlugin implements RspackPluginInstance {
672679 name: string ;
673680}
674681
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+
675698// @public (undocumented)
676699export type TCaseSummary = Record <TCaseSummaryId , number >;
677700
@@ -700,6 +723,24 @@ export type TCompilation<T> = T extends ECompilerType.Rspack ? Compilation : Com
700723// @public (undocumented)
701724export type TCompiler <T > = T extends ECompilerType .Rspack ? Compiler : Compiler_2 ;
702725
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+
703744// @public (undocumented)
704745export type TCompilerFactories <T extends ECompilerType > = Record <T , TCompilerFactory <T >>;
705746
@@ -721,6 +762,14 @@ export type TCompilerStatsCompilation<T> = T extends ECompilerType.Rspack ? Stat
721762// @public (undocumented)
722763export type TCompilerTypeId = ECompilerType .Rspack | ECompilerType .Webpack | " common" ;
723764
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+
724773// @public (undocumented)
725774export type TDiffStats = {
726775 root: string ;
@@ -738,6 +787,15 @@ export type TDiffStatsItem = {
738787// @public (undocumented)
739788export type TDimenTypeId = " modules" | " lines" | " lines-in-common" ;
740789
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+
741799// @public (undocumented)
742800export class TestContext implements ITestContext {
743801 constructor (config : TTestContextOptions );
@@ -848,6 +906,16 @@ export type TRunnerRequirer = (currentDirectory: string, modulePath: string[] |
848906 esmMode? : EEsmMode ;
849907}) => Object | Promise <Object >;
850908
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+
851919// @public (undocumented)
852920export type TTestConfig <T extends ECompilerType > = {
853921 documentType? : EDocumentType ;
0 commit comments