File tree Expand file tree Collapse file tree 4 files changed +12
-24
lines changed Expand file tree Collapse file tree 4 files changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ describe('watch', () => {
28
28
await cli . waitForStdout ( 'Duration' ) ;
29
29
expect ( cli . stdout ) . toMatch ( 'Tests 1 passed' ) ;
30
30
expect ( cli . stdout ) . not . toMatch ( 'Test files to re-run:' ) ;
31
- expect ( cli . stdout ) . toMatch ( 'Fully run test files for first run .' ) ;
31
+ expect ( cli . stdout ) . toMatch ( 'Run all tests .' ) ;
32
32
33
33
// create
34
34
cli . resetStd ( ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ describe('CLI shortcuts', () => {
37
37
await cli . waitForStdout ( 'Duration' ) ;
38
38
expect ( cli . stdout ) . toMatch ( 'Tests 1 failed | 1 passed' ) ;
39
39
await cli . waitForStdout ( 'press h to show help' ) ;
40
- expect ( cli . stdout ) . toMatch ( 'Fully run test files for first run .' ) ;
40
+ expect ( cli . stdout ) . toMatch ( 'Run all tests .' ) ;
41
41
42
42
cli . exec . process ! . stdin ! . write ( 'h' ) ;
43
43
@@ -82,7 +82,7 @@ describe('CLI shortcuts', () => {
82
82
await cli . waitForStdout ( 'Duration' ) ;
83
83
expect ( cli . stdout ) . toMatch ( 'Tests 1 failed | 1 passed' ) ;
84
84
await cli . waitForStdout ( 'press h to show help' ) ;
85
- expect ( cli . stdout ) . toMatch ( 'Fully run test files for first run .' ) ;
85
+ expect ( cli . stdout ) . toMatch ( 'Run all tests .' ) ;
86
86
cli . resetStd ( ) ;
87
87
88
88
// rerun failed tests
Original file line number Diff line number Diff line change @@ -228,15 +228,13 @@ export const createRsbuildServer = async ({
228
228
assetFiles : Record < string , string > ;
229
229
sourceMaps : Record < string , SourceMapInput > ;
230
230
getSourcemap : ( sourcePath : string ) => SourceMapInput | null ;
231
- isFirstRun : boolean ;
232
231
affectedEntries : EntryInfo [ ] ;
233
232
deletedEntries : string [ ] ;
234
233
} > ;
235
234
closeServer : ( ) => Promise < void > ;
236
235
} > => {
237
236
// Read files from memory via `rspackCompiler.outputFileSystem`
238
237
let rspackCompiler : Rspack . Compiler | Rspack . MultiCompiler | undefined ;
239
- let isFirstCompile = false ;
240
238
241
239
const rstestCompilerPlugin : RsbuildPlugin = {
242
240
name : 'rstest:compiler' ,
@@ -245,10 +243,6 @@ export const createRsbuildServer = async ({
245
243
// outputFileSystem to be updated later by `rsbuild-dev-middleware`
246
244
rspackCompiler = compiler ;
247
245
} ) ;
248
-
249
- api . onAfterDevCompile ( ( { isFirstCompile : _isFirstCompile } ) => {
250
- isFirstCompile = _isFirstCompile ;
251
- } ) ;
252
246
} ,
253
247
} ;
254
248
@@ -410,7 +404,6 @@ export const createRsbuildServer = async ({
410
404
return {
411
405
affectedEntries,
412
406
deletedEntries,
413
- isFirstRun : isFirstCompile ,
414
407
hash,
415
408
entries,
416
409
setupEntries,
Original file line number Diff line number Diff line change @@ -122,28 +122,23 @@ export async function runTests(context: Rstest): Promise<void> {
122
122
getSourcemap,
123
123
buildTime,
124
124
hash,
125
- isFirstRun,
126
125
affectedEntries,
127
126
deletedEntries,
128
127
} = await getRsbuildStats ( { fileFilters } ) ;
129
128
const testStart = Date . now ( ) ;
130
129
131
130
let finalEntries : EntryInfo [ ] = entries ;
132
131
if ( mode === 'on-demand' ) {
133
- if ( isFirstRun ) {
134
- logger . debug ( color . yellow ( 'Fully run test files for first run.\n ' ) ) ;
132
+ if ( affectedEntries . length === 0 ) {
133
+ logger . debug ( color . yellow ( 'No test files are re- run.' ) ) ;
135
134
} else {
136
- if ( affectedEntries . length === 0 ) {
137
- logger . debug ( color . yellow ( 'No test files are re-run.' ) ) ;
138
- } else {
139
- logger . debug (
140
- color . yellow ( 'Test files to re-run:\n' ) +
141
- affectedEntries . map ( ( e ) => e . testPath ) . join ( '\n' ) +
142
- '\n' ,
143
- ) ;
144
- }
145
- finalEntries = affectedEntries ;
135
+ logger . debug (
136
+ color . yellow ( 'Test files to re-run:\n' ) +
137
+ affectedEntries . map ( ( e ) => e . testPath ) . join ( '\n' ) +
138
+ '\n' ,
139
+ ) ;
146
140
}
141
+ finalEntries = affectedEntries ;
147
142
} else {
148
143
logger . debug (
149
144
color . yellow (
@@ -228,7 +223,7 @@ export async function runTests(context: Rstest): Promise<void> {
228
223
229
224
rsbuildInstance . onAfterDevCompile ( async ( { isFirstCompile } ) => {
230
225
snapshotManager . clear ( ) ;
231
- await run ( { mode : 'on-demand' } ) ;
226
+ await run ( { mode : isFirstCompile ? 'all' : 'on-demand' } ) ;
232
227
233
228
if ( isFirstCompile && enableCliShortcuts ) {
234
229
const closeCliShortcuts = await setupCliShortcuts ( {
You can’t perform that action at this time.
0 commit comments