@@ -20,6 +20,7 @@ import { colors } from 'playwright-core/lib/utils';
2020import { addSuggestedRebaseline } from './rebase' ;
2121import { WorkerHost } from './workerHost' ;
2222import { serializeConfig } from '../common/ipc' ;
23+ import { addLocationAndSnippetToError } from '../reporters/internalReporter' ;
2324
2425import type { FailureTracker } from './failureTracker' ;
2526import type { ProcessExitData } from './processHost' ;
@@ -98,7 +99,7 @@ export class Dispatcher {
9899
99100 // 3. Claim both the job and the worker slot.
100101 this . _queue . splice ( jobIndex , 1 ) ;
101- const jobDispatcher = new JobDispatcher ( job , this . _reporter , this . _failureTracker , ( ) => this . stop ( ) . catch ( ( ) => { } ) ) ;
102+ const jobDispatcher = new JobDispatcher ( job , this . _config , this . _reporter , this . _failureTracker , ( ) => this . stop ( ) . catch ( ( ) => { } ) ) ;
102103 this . _workerSlots [ workerIndex ] . busy = true ;
103104 this . _workerSlots [ workerIndex ] . jobDispatcher = jobDispatcher ;
104105
@@ -278,6 +279,7 @@ class JobDispatcher {
278279 jobResult = new ManualPromise < { newJob ?: TestGroup , didFail : boolean } > ( ) ;
279280
280281 readonly job : TestGroup ;
282+ private _config : FullConfigInternal ;
281283 private _reporter : ReporterV2 ;
282284 private _failureTracker : FailureTracker ;
283285 private _stopCallback : ( ) => void ;
@@ -290,8 +292,9 @@ class JobDispatcher {
290292 private _workerIndex = 0 ;
291293 private _currentlyRunning : { test : TestCase , result : TestResult } | undefined ;
292294
293- constructor ( job : TestGroup , reporter : ReporterV2 , failureTracker : FailureTracker , stopCallback : ( ) => void ) {
295+ constructor ( job : TestGroup , config : FullConfigInternal , reporter : ReporterV2 , failureTracker : FailureTracker , stopCallback : ( ) => void ) {
294296 this . job = job ;
297+ this . _config = config ;
295298 this . _reporter = reporter ;
296299 this . _failureTracker = failureTracker ;
297300 this . _stopCallback = stopCallback ;
@@ -574,6 +577,11 @@ class JobDispatcher {
574577 eventsHelper . addEventListener ( worker , 'stepBegin' , this . _onStepBegin . bind ( this ) ) ,
575578 eventsHelper . addEventListener ( worker , 'stepEnd' , this . _onStepEnd . bind ( this ) ) ,
576579 eventsHelper . addEventListener ( worker , 'attach' , this . _onAttach . bind ( this ) ) ,
580+ eventsHelper . addEventListener ( worker , 'testPaused' , params => {
581+ for ( const error of params . errors )
582+ addLocationAndSnippetToError ( this . _config . config , error ) ;
583+ this . _failureTracker . onTestPaused ?.( params ) ;
584+ } ) ,
577585 eventsHelper . addEventListener ( worker , 'done' , this . _onDone . bind ( this ) ) ,
578586 eventsHelper . addEventListener ( worker , 'exit' , this . onExit . bind ( this ) ) ,
579587 ] ;
0 commit comments