@@ -15,19 +15,11 @@ vi.mock('../symbolicate.js', async () => {
1515 } ;
1616} ) ;
1717
18- const getTask = ( context ?: HarnessTestContext ) => {
19- if ( ! context ) {
20- throw new Error ( 'Expected test context to be defined' ) ;
21- }
22-
18+ const getTask = ( context : HarnessTestContext ) => {
2319 return context . task ;
2420} ;
2521
26- const getTaskContext = ( context ?: HarnessTestContext ) => {
27- if ( ! context ) {
28- throw new Error ( 'Expected test context to be defined' ) ;
29- }
30-
22+ const getTaskContext = ( context : HarnessTestContext ) => {
3123 return context ;
3224} ;
3325
@@ -49,15 +41,15 @@ describe('runner task context', () => {
4941 try {
5042 const collection = await collector . collect ( ( ) => {
5143 harnessDescribe ( 'Task Context Suite' , ( ) => {
52- beforeEach ( ( context : HarnessTestContext | undefined ) => {
44+ beforeEach ( ( context : HarnessTestContext ) => {
5345 observedTasks . push ( { source : 'beforeEach' , task : getTask ( context ) } ) ;
5446 } ) ;
5547
56- afterEach ( ( context : HarnessTestContext | undefined ) => {
48+ afterEach ( ( context : HarnessTestContext ) => {
5749 observedTasks . push ( { source : 'afterEach' , task : getTask ( context ) } ) ;
5850 } ) ;
5951
60- harnessIt ( 'exposes task metadata' , ( context : HarnessTestContext | undefined ) => {
52+ harnessIt ( 'exposes task metadata' , ( context : HarnessTestContext ) => {
6153 observedTasks . push ( { source : 'test' , task : getTask ( context ) } ) ;
6254 } ) ;
6355 } ) ;
@@ -160,7 +152,7 @@ describe('runner task context', () => {
160152 calls . push ( 'afterEach' ) ;
161153 } ) ;
162154
163- harnessIt ( 'skips from context' , ( context : HarnessTestContext | undefined ) => {
155+ harnessIt ( 'skips from context' , ( context : HarnessTestContext ) => {
164156 const { skip } = getTaskContext ( context ) ;
165157
166158 calls . push ( 'before-skip' ) ;
@@ -204,7 +196,7 @@ describe('runner task context', () => {
204196 try {
205197 const collection = await collector . collect ( ( ) => {
206198 harnessDescribe ( 'Conditional Skip Suite' , ( ) => {
207- harnessIt ( 'continues when condition is false' , ( context : HarnessTestContext | undefined ) => {
199+ harnessIt ( 'continues when condition is false' , ( context : HarnessTestContext ) => {
208200 const { skip } = getTaskContext ( context ) ;
209201
210202 calls . push ( 'before' ) ;
@@ -240,7 +232,7 @@ describe('runner task context', () => {
240232 calls . push ( 'afterEach' ) ;
241233 } ) ;
242234
243- harnessIt ( 'runs finished callbacks' , ( context : HarnessTestContext | undefined ) => {
235+ harnessIt ( 'runs finished callbacks' , ( context : HarnessTestContext ) => {
244236 const { onTestFinished } = getTaskContext ( context ) ;
245237
246238 onTestFinished ( ( ) => {
@@ -288,7 +280,7 @@ describe('runner task context', () => {
288280
289281 harnessIt (
290282 'runs finished callback after skip' ,
291- ( context : HarnessTestContext | undefined ) => {
283+ ( context : HarnessTestContext ) => {
292284 const { onTestFinished, skip } = getTaskContext ( context ) ;
293285
294286 onTestFinished ( ( ) => {
@@ -330,7 +322,7 @@ describe('runner task context', () => {
330322
331323 harnessIt (
332324 'runs finished callback after failure' ,
333- ( context : HarnessTestContext | undefined ) => {
325+ ( context : HarnessTestContext ) => {
334326 const { onTestFinished } = getTaskContext ( context ) ;
335327
336328 onTestFinished ( ( ) => {
@@ -370,7 +362,7 @@ describe('runner task context', () => {
370362 calls . push ( 'afterEach' ) ;
371363 } ) ;
372364
373- harnessIt ( 'runs failed callbacks' , ( context : HarnessTestContext | undefined ) => {
365+ harnessIt ( 'runs failed callbacks' , ( context : HarnessTestContext ) => {
374366 const { onTestFailed } = getTaskContext ( context ) ;
375367
376368 onTestFailed ( ( ) => {
@@ -419,7 +411,7 @@ describe('runner task context', () => {
419411
420412 harnessIt (
421413 'does not run failed callbacks on skip' ,
422- ( context : HarnessTestContext | undefined ) => {
414+ ( context : HarnessTestContext ) => {
423415 const { onTestFailed, skip } = getTaskContext ( context ) ;
424416
425417 onTestFailed ( ( ) => {
@@ -462,7 +454,7 @@ describe('runner task context', () => {
462454
463455 harnessIt (
464456 'runs failed callback after afterEach failure' ,
465- ( context : HarnessTestContext | undefined ) => {
457+ ( context : HarnessTestContext ) => {
466458 const { onTestFailed } = getTaskContext ( context ) ;
467459
468460 onTestFailed ( ( ) => {
0 commit comments