@@ -60,14 +60,14 @@ export async function runUnifiedTest(
60
60
ctx : Mocha . Context ,
61
61
unifiedSuite : uni . UnifiedSuite ,
62
62
test : uni . Test ,
63
- skipFilter ?: ( test : uni . Test ) => boolean
63
+ skipFilter ?: uni . TestFilter
64
64
) : Promise < void > ;
65
65
66
66
export async function runUnifiedTest (
67
67
ctx : Mocha . Context ,
68
68
unifiedSuite : uni . UnifiedSuite ,
69
69
test : uni . Test ,
70
- testsToSkipOrFilter ?: string [ ] | ( ( test : uni . Test ) => boolean )
70
+ testsToSkipOrFilter ?: string [ ] | uni . TestFilter
71
71
) : Promise < void > {
72
72
// Some basic expectations we can catch early
73
73
expect ( test ) . to . exist ;
@@ -77,7 +77,8 @@ export async function runUnifiedTest(
77
77
78
78
if ( Array . isArray ( testsToSkipOrFilter ) ) {
79
79
const testsToSkip = testsToSkipOrFilter ;
80
- testsToSkipOrFilter = ( test : uni . Test ) => testsToSkip . includes ( test . description ) ;
80
+ testsToSkipOrFilter = ( { description } ) =>
81
+ testsToSkip . includes ( description ) ? 'Test was filtered without a skip reason' : null ;
81
82
}
82
83
83
84
const schemaVersion = patchVersion ( unifiedSuite . schemaVersion ) ;
@@ -90,6 +91,16 @@ export async function runUnifiedTest(
90
91
ctx . skip ( ) ;
91
92
}
92
93
94
+ const skipReason = testsToSkipOrFilter ?.( test ) ;
95
+
96
+ if ( typeof skipReason === 'string' ) {
97
+ if ( skipReason . length === 0 ) {
98
+ expect . fail ( `Test was skipped with an empty skip reason: ${ test . description } ` ) ;
99
+ }
100
+ ctx . skipReason = skipReason ;
101
+ ctx . skip ( ) ;
102
+ }
103
+
93
104
if ( testsToSkipOrFilter ?.( test ) ) {
94
105
ctx . skip ( ) ;
95
106
}
@@ -279,14 +290,11 @@ export function runUnifiedSuite(specTests: uni.UnifiedSuite[], testsToSkip?: str
279
290
*
280
291
* @param skipFilter - a function that returns true if the test should be skipped
281
292
*/
282
- export function runUnifiedSuite (
283
- specTests : uni . UnifiedSuite [ ] ,
284
- skipFilter ?: ( test : uni . Test ) => boolean
285
- ) : void ;
293
+ export function runUnifiedSuite ( specTests : uni . UnifiedSuite [ ] , skipFilter ?: uni . TestFilter ) : void ;
286
294
287
295
export function runUnifiedSuite (
288
296
specTests : uni . UnifiedSuite [ ] ,
289
- testsToSkipOrFilter ?: string [ ] | ( ( test : uni . Test ) => boolean )
297
+ testsToSkipOrFilter ?: string [ ] | uni . TestFilter
290
298
) : void {
291
299
for ( const unifiedSuite of specTests ) {
292
300
context ( String ( unifiedSuite . description ) , function ( ) {
0 commit comments