1313 * them. `UPDATE_TEMPLATES_GOLDEN=1` writes it again from the
1414 * compiler at hand, so it is written with a compiler from before.
1515 */
16- import { describe , it , expect , afterAll } from "vitest" ;
16+ import { describe , it , expect , afterAll , afterEach } from "vitest" ;
1717import { createHash } from "crypto" ;
1818import { promises as fs } from "fs" ;
1919import path from "path" ;
@@ -159,6 +159,8 @@ async function eachPointer(
159159 const entries = localsOf ( context ) . filter ( ( { pointer } ) => pointer ) ;
160160 if ( entries . length === 0 ) continue ;
161161 const state = run . stateAt ( k + 1 ) ;
162+ // (give the event loop a turn; see `afterEach` below)
163+ await new Promise < void > ( ( resolve ) => setImmediate ( resolve ) ) ;
162164 for ( const { identifier, pointer } of entries ) {
163165 const label = `${ calldata . slice ( 0 , 8 ) } ${ k } ${ identifier } ` ;
164166 await visit ( label , pointer as Format . Pointer , state , templates ) ;
@@ -173,6 +175,12 @@ async function eachPointer(
173175 }
174176}
175177
178+ // A long run of reads never turns the event loop, so the worker cannot
179+ // read vitest's replies to its progress reports, and once that lasts a
180+ // minute, vitest fails the run with 'Timeout calling "onTaskUpdate"'
181+ // (as in test/examples/examples.test.ts).
182+ afterEach ( ( ) => new Promise < void > ( ( resolve ) => setImmediate ( resolve ) ) ) ;
183+
176184async function examples ( ) : Promise < Array < [ string , string ] > > {
177185 const files = await glob ( "**/*.bug" , { cwd : EXAMPLES_DIR } ) ;
178186 const sources : Array < [ string , string ] > = [ ] ;
0 commit comments