@@ -8,22 +8,19 @@ import {getPromiseWithResolveAndReject} from '../promise';
88
99import type { Onlog , RejectTestRun , RunId , TestFn , Void } from '../../types/internal' ;
1010
11+ import { test as playwrightTest } from '@playwright/test' ;
12+
1113type Options = Readonly < {
1214 isSkipped : boolean ;
1315 runId : RunId ;
16+ skipReason : string | undefined ;
1417 testFn : TestFn ;
1518 testIdleTimeout : number ;
1619 testTimeout : number ;
1720} > ;
1821
1922type Return = Readonly < { onlog : Onlog ; reject : RejectTestRun ; testFnWithReject : TestFn } > ;
2023
21- const skippedTestFnAndReject : Return = {
22- onlog : ( ) => undefined ,
23- reject : ( ) => undefined ,
24- testFnWithReject : ( ) => RESOLVED_PROMISE ,
25- } ;
26-
2724/**
2825 * Get test function with execution timeout, idle timeout, reject and onlog functions,
2926 * by isSkipped flag, test function, runId, test execution timeout and test idle timeouts.
@@ -32,12 +29,23 @@ const skippedTestFnAndReject: Return = {
3229export const getTestFnAndReject = ( {
3330 isSkipped,
3431 runId,
32+ skipReason,
3533 testFn,
3634 testIdleTimeout,
3735 testTimeout,
3836} : Options ) : Return => {
3937 if ( isSkipped ) {
40- return skippedTestFnAndReject ;
38+ return {
39+ onlog : ( ) => undefined ,
40+ reject : ( ) => undefined ,
41+ testFnWithReject : ( ) => {
42+ try {
43+ playwrightTest . skip ( true , skipReason ) ;
44+ } catch { }
45+
46+ return RESOLVED_PROMISE ;
47+ } ,
48+ } ;
4149 }
4250
4351 const {
0 commit comments