Skip to content

Commit 4548937

Browse files
authored
test: remove processor (#11738)
* test: remove processor * test: remove processor * test: remove processor
1 parent 406e14f commit 4548937

35 files changed

+2193
-2543
lines changed

packages/rspack-test-tools/etc/test-tools.api.md

Lines changed: 9 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -61,33 +61,6 @@ export class BasicCaseCreator<T extends ECompilerType> {
6161
protected tryRunTask(): void;
6262
}
6363

64-
// @public (undocumented)
65-
export class BasicProcessor<T extends ECompilerType> implements ITestProcessor {
66-
constructor(_options: IBasicProcessorOptions<T>);
67-
// (undocumented)
68-
after(context: ITestContext): Promise<void>;
69-
// (undocumented)
70-
afterAll(context: ITestContext): Promise<void>;
71-
// (undocumented)
72-
before(context: ITestContext): Promise<void>;
73-
// (undocumented)
74-
beforeAll(context: ITestContext): Promise<void>;
75-
// (undocumented)
76-
build(context: ITestContext): Promise<void>;
77-
// (undocumented)
78-
check(env: ITestEnv, context: ITestContext): Promise<void>;
79-
// (undocumented)
80-
compiler(context: ITestContext): Promise<void>;
81-
// (undocumented)
82-
config(context: ITestContext): Promise<void>;
83-
// (undocumented)
84-
protected getCompiler(context: ITestContext): ITestCompilerManager<T>;
85-
// (undocumented)
86-
protected _options: IBasicProcessorOptions<T>;
87-
// (undocumented)
88-
run(env: ITestEnv, context: ITestContext): Promise<void>;
89-
}
90-
9164
// @public (undocumented)
9265
export class BasicRunnerFactory<T extends ECompilerType> implements TRunnerFactory<T> {
9366
constructor(name: string, context: ITestContext);
@@ -223,19 +196,6 @@ export class DiffHtmlReporter implements ITestReporter<TModuleCompareResult[]> {
223196
output(): Promise<void>;
224197
}
225198

226-
// @public (undocumented)
227-
export class DiffProcessor implements ITestProcessor {
228-
constructor(options: IDiffProcessorOptions);
229-
// (undocumented)
230-
build(context: ITestContext): Promise<void>;
231-
// (undocumented)
232-
check(env: ITestEnv, context: ITestContext): Promise<void>;
233-
// (undocumented)
234-
compiler(context: ITestContext): Promise<void>;
235-
// (undocumented)
236-
config(context: ITestContext): Promise<void>;
237-
}
238-
239199
// @public (undocumented)
240200
export class DiffStatsReporter implements ITestReporter<TModuleCompareResult[]> {
241201
constructor(options: IDiffStatsReporterOptions);
@@ -339,30 +299,6 @@ export interface IBasicCaseCreatorOptions<T extends ECompilerType> {
339299
timeout?: number;
340300
}
341301

342-
// @public (undocumented)
343-
export interface IBasicProcessorOptions<T extends ECompilerType> {
344-
// (undocumented)
345-
build?: (context: ITestContext, compiler: TCompiler<T>) => Promise<void>;
346-
// (undocumented)
347-
check?: (env: ITestEnv, context: ITestContext, compiler: TCompiler<T>, stats: TCompilerStats<T> | TCompilerMultiStats<T> | null) => Promise<void>;
348-
// (undocumented)
349-
compiler?: (context: ITestContext, compiler: TCompiler<T>) => Promise<void>;
350-
// (undocumented)
351-
compilerType: T;
352-
// (undocumented)
353-
configFiles?: string[];
354-
// (undocumented)
355-
defaultOptions?: (context: ITestContext) => TCompilerOptions<T>;
356-
// (undocumented)
357-
findBundle?: (context: ITestContext, options: TCompilerOptions<T>) => string[] | string | void;
358-
// (undocumented)
359-
name: string;
360-
// (undocumented)
361-
overrideOptions?: (context: ITestContext, options: TCompilerOptions<T>) => void;
362-
// (undocumented)
363-
runable: boolean;
364-
}
365-
366302
// @public (undocumented)
367303
export interface ICompareOptions {
368304
// (undocumented)
@@ -417,36 +353,6 @@ export interface IDiffHtmlReporterOptions {
417353
ignore?: RegExp;
418354
}
419355

420-
// @public (undocumented)
421-
export interface IDiffProcessorOptions extends IFormatCodeOptions {
422-
// (undocumented)
423-
bootstrap?: boolean;
424-
// (undocumented)
425-
detail?: boolean;
426-
// (undocumented)
427-
errors?: boolean;
428-
// (undocumented)
429-
files?: string[];
430-
// (undocumented)
431-
modules?: TCompareModules;
432-
// (undocumented)
433-
onCompareFile?: (file: string, result: TFileCompareResult) => void;
434-
// (undocumented)
435-
onCompareModules?: (file: string, results: TModuleCompareResult[]) => void;
436-
// (undocumented)
437-
onCompareRuntimeModules?: (file: string, results: TModuleCompareResult[]) => void;
438-
// (undocumented)
439-
renameModule?: (file: string) => string;
440-
// (undocumented)
441-
replacements?: IFormatCodeReplacement[];
442-
// (undocumented)
443-
rspackPath: string;
444-
// (undocumented)
445-
runtimeModules?: TCompareModules;
446-
// (undocumented)
447-
webpackPath: string;
448-
}
449-
450356
// @public (undocumented)
451357
export interface IDiffStatsReporterOptions {
452358
// (undocumented)
@@ -511,28 +417,6 @@ export interface IModuleScope extends ITestEnv {
511417
expect: jest.Expect;
512418
}
513419

514-
// @public (undocumented)
515-
export interface IMultiTaskProcessorOptions<T extends ECompilerType> {
516-
// (undocumented)
517-
check?: (env: ITestEnv, context: ITestContext, compiler: TCompiler<T>, stats: TCompilerStats<T> | TCompilerMultiStats<T> | null) => Promise<void>;
518-
// (undocumented)
519-
compiler?: (context: ITestContext, compiler: TCompiler<T>) => Promise<void>;
520-
// (undocumented)
521-
compilerType: T;
522-
// (undocumented)
523-
configFiles?: string[];
524-
// (undocumented)
525-
defaultOptions?: (index: number, context: ITestContext) => TCompilerOptions<T>;
526-
// (undocumented)
527-
findBundle?: (index: number, context: ITestContext, options: TCompilerOptions<T>) => string[] | string | void;
528-
// (undocumented)
529-
name: string;
530-
// (undocumented)
531-
overrideOptions?: (index: number, context: ITestContext, options: TCompilerOptions<T>) => void;
532-
// (undocumented)
533-
runable: boolean;
534-
}
535-
536420
// @public (undocumented)
537421
export interface INodeRunnerOptions<T extends ECompilerType> {
538422
// (undocumented)
@@ -564,35 +448,9 @@ export const isDirectory: (p: string) => boolean;
564448
// @public (undocumented)
565449
export const isFile: (p: string) => boolean;
566450

567-
// @public (undocumented)
568-
export interface ISimpleProcessorOptions<T extends ECompilerType> {
569-
// (undocumented)
570-
build?: (context: ITestContext, compiler: TCompiler<T>) => Promise<void>;
571-
// (undocumented)
572-
check?: (env: ITestEnv, context: ITestContext, compiler: TCompiler<T>, stats: TCompilerStats<T>) => Promise<void>;
573-
// (undocumented)
574-
compiler?: (context: ITestContext, compiler: TCompiler<T>) => Promise<void>;
575-
// (undocumented)
576-
compilerCallback?: (error: Error | null, stats: TCompilerStats<T> | null) => void;
577-
// (undocumented)
578-
compilerType: T;
579-
// (undocumented)
580-
name: string;
581-
// (undocumented)
582-
options?: (context: ITestContext) => TCompilerOptions<T>;
583-
}
584-
585451
// @public (undocumented)
586452
export function isJavaScript(filePath: string): boolean;
587453

588-
// @public (undocumented)
589-
export interface ISnapshotProcessorOptions<T extends ECompilerType> extends IBasicProcessorOptions<T> {
590-
// (undocumented)
591-
snapshot: string;
592-
// (undocumented)
593-
snapshotFileFilter?: (file: string) => boolean;
594-
}
595-
596454
// @public (undocumented)
597455
export function isUpdateSnapshot(): boolean;
598456

@@ -630,6 +488,8 @@ export interface ITestContext {
630488
// (undocumented)
631489
clearError(name?: string): void;
632490
// (undocumented)
491+
closeCompiler(name: string): Promise<void>;
492+
// (undocumented)
633493
emitError(name: string, err: Error | string): void;
634494
// (undocumented)
635495
getCompiler<T extends ECompilerType>(name: string, type: T | void): ITestCompilerManager<T>;
@@ -732,15 +592,15 @@ export interface ITestProcessor {
732592
// (undocumented)
733593
beforeAll?(context: ITestContext): Promise<void>;
734594
// (undocumented)
735-
build?(context: ITestContext): Promise<void>;
595+
build(context: ITestContext): Promise<void>;
736596
// (undocumented)
737-
check?(env: ITestEnv, context: ITestContext): Promise<unknown>;
597+
check(env: ITestEnv, context: ITestContext): Promise<unknown>;
738598
// (undocumented)
739-
compiler?(context: ITestContext): Promise<void>;
599+
compiler(context: ITestContext): Promise<void>;
740600
// (undocumented)
741-
config?(context: ITestContext): Promise<void>;
601+
config(context: ITestContext): Promise<void>;
742602
// (undocumented)
743-
run?(env: ITestEnv, context: ITestContext): Promise<void>;
603+
run(env: ITestEnv, context: ITestContext): Promise<void>;
744604
}
745605

746606
// @public (undocumented)
@@ -765,20 +625,6 @@ export interface ITestRunner {
765625
run(file: string): Promise<unknown>;
766626
}
767627

768-
// @public (undocumented)
769-
export interface IWatchProcessorOptions<T extends ECompilerType> extends IMultiTaskProcessorOptions<T> {
770-
// (undocumented)
771-
nativeWatcher?: boolean;
772-
// (undocumented)
773-
stepName: string;
774-
// (undocumented)
775-
tempDir: string;
776-
}
777-
778-
// @public (undocumented)
779-
export interface IWatchStepProcessorOptions<T extends ECompilerType> extends Omit<IWatchProcessorOptions<T>, "experiments" | "optimization"> {
780-
}
781-
782628
// @public (undocumented)
783629
export class LazyCompilationTestPlugin {
784630
// (undocumented)
@@ -800,17 +646,6 @@ export class MultipleRunnerFactory<T extends ECompilerType> extends BasicRunnerF
800646
protected runned: Set<string>;
801647
}
802648

803-
// @public (undocumented)
804-
export class MultiTaskProcessor<T extends ECompilerType> extends BasicProcessor<T> implements ITestProcessor {
805-
constructor(_multiOptions: IMultiTaskProcessorOptions<T>);
806-
// (undocumented)
807-
config(context: ITestContext): Promise<void>;
808-
// (undocumented)
809-
protected multiCompilerOptions: TCompilerOptions<T>[];
810-
// (undocumented)
811-
protected _multiOptions: IMultiTaskProcessorOptions<T>;
812-
}
813-
814649
// @public (undocumented)
815650
export class NodeRunner<T extends ECompilerType = ECompilerType.Rspack> implements ITestRunner {
816651
constructor(_options: INodeRunnerOptions<T>);
@@ -881,44 +716,6 @@ export class RspackDiffConfigPlugin implements RspackPluginInstance {
881716
name: string;
882717
}
883718

884-
// @public (undocumented)
885-
export class SimpleTaskProcessor<T extends ECompilerType> implements ITestProcessor {
886-
constructor(_options: ISimpleProcessorOptions<T>);
887-
// (undocumented)
888-
after(context: ITestContext): Promise<void>;
889-
// (undocumented)
890-
afterAll(context: ITestContext): Promise<void>;
891-
// (undocumented)
892-
before(context: ITestContext): Promise<void>;
893-
// (undocumented)
894-
beforeAll(context: ITestContext): Promise<void>;
895-
// (undocumented)
896-
build(context: ITestContext): Promise<void>;
897-
// (undocumented)
898-
check(env: ITestEnv, context: ITestContext): Promise<void>;
899-
// (undocumented)
900-
compiler(context: ITestContext): Promise<void>;
901-
// (undocumented)
902-
config(context: ITestContext): Promise<void>;
903-
// (undocumented)
904-
protected getCompiler(context: ITestContext): ITestCompilerManager<T>;
905-
// (undocumented)
906-
protected _options: ISimpleProcessorOptions<T>;
907-
// (undocumented)
908-
run(env: ITestEnv, context: ITestContext): Promise<void>;
909-
}
910-
911-
// @public (undocumented)
912-
export class SnapshotProcessor<T extends ECompilerType> extends BasicProcessor<T> {
913-
constructor(_snapshotOptions: ISnapshotProcessorOptions<T>);
914-
// (undocumented)
915-
check(env: ITestEnv, context: ITestContext): Promise<void>;
916-
// (undocumented)
917-
serializeEachFile(content: string): string;
918-
// (undocumented)
919-
protected _snapshotOptions: ISnapshotProcessorOptions<T>;
920-
}
921-
922719
// @public (undocumented)
923720
export type TCaseSummary = Record<TCaseSummaryId, number>;
924721

@@ -991,6 +788,8 @@ export class TestContext implements ITestContext {
991788
// (undocumented)
992789
clearError(name?: string): void;
993790
// (undocumented)
791+
closeCompiler(name: string): Promise<void>;
792+
// (undocumented)
994793
protected compilers: Map<string, ITestCompilerManager<ECompilerType>>;
995794
// (undocumented)
996795
emitError(name: string, err: Error | string): void;
@@ -1151,33 +950,6 @@ type WatchIncrementalOptions = {
1151950
ignoreNotFriendlyForIncrementalWarnings?: boolean;
1152951
};
1153952

1154-
// @public (undocumented)
1155-
export class WatchProcessor<T extends ECompilerType> extends MultiTaskProcessor<T> {
1156-
constructor(_watchOptions: IWatchProcessorOptions<T>, _watchState: Record<string, any>);
1157-
// (undocumented)
1158-
build(context: ITestContext): Promise<void>;
1159-
// (undocumented)
1160-
check(env: ITestEnv, context: ITestContext): Promise<void>;
1161-
// (undocumented)
1162-
compiler(context: ITestContext): Promise<void>;
1163-
// (undocumented)
1164-
config(context: ITestContext): Promise<void>;
1165-
// (undocumented)
1166-
protected currentTriggerFilename: string | null;
1167-
// (undocumented)
1168-
static findBundle<T extends ECompilerType>(this: IWatchProcessorOptions<T>, index: number, context: ITestContext, options: TCompilerOptions<T>): string | string[];
1169-
// (undocumented)
1170-
protected lastHash: string | null;
1171-
// (undocumented)
1172-
static overrideOptions<T extends ECompilerType>({ tempDir, nativeWatcher }: IWatchProcessorOptions<T>): (index: number, context: ITestContext, options: TCompilerOptions<ECompilerType>) => void;
1173-
// (undocumented)
1174-
run(env: ITestEnv, context: ITestContext): Promise<void>;
1175-
// (undocumented)
1176-
protected _watchOptions: IWatchProcessorOptions<T>;
1177-
// (undocumented)
1178-
protected _watchState: Record<string, any>;
1179-
}
1180-
1181953
// @public (undocumented)
1182954
export class WatchRunnerFactory<T extends ECompilerType> extends BasicRunnerFactory<T> {
1183955
// (undocumented)
@@ -1188,19 +960,6 @@ export class WatchRunnerFactory<T extends ECompilerType> extends BasicRunnerFact
1188960
protected getRunnerKey(file: string): string;
1189961
}
1190962

1191-
// @public (undocumented)
1192-
export class WatchStepProcessor<T extends ECompilerType> extends WatchProcessor<T> {
1193-
constructor(_watchOptions: IWatchStepProcessorOptions<T>, _watchState: Record<string, any>);
1194-
// (undocumented)
1195-
build(context: ITestContext): Promise<void>;
1196-
// (undocumented)
1197-
compiler(context: ITestContext): Promise<void>;
1198-
// (undocumented)
1199-
protected _watchOptions: IWatchStepProcessorOptions<T>;
1200-
// (undocumented)
1201-
protected _watchState: Record<string, any>;
1202-
}
1203-
1204963
// @public (undocumented)
1205964
export class WebpackDiffConfigPlugin {
1206965
constructor(modifier?: ((options: WebpackOptionsNormalized) => WebpackOptionsNormalized) | undefined);

0 commit comments

Comments
 (0)