@@ -10,7 +10,7 @@ import {
1010 triggerPromise ,
1111 waitsForInputGate ,
1212} from "@miniflare/shared-test" ;
13- import test , { ThrowsExpectation } from "ava" ;
13+ import test from "ava" ;
1414
1515test ( "inputGatedSetTimeout: calls callback with no input gate in context" , async ( t ) => {
1616 const [ trigger , promise ] = triggerPromise < [ number , string ] > ( ) ;
@@ -109,15 +109,17 @@ test("AbortSignal.timeout: triggers signal after timeout", async (t) => {
109109 t . true ( aborted ) ;
110110} ) ;
111111test ( "AbortSignal.timeout: requires numeric timeout" , ( t ) => {
112- const expectations : ThrowsExpectation = {
112+ // @ts -expect-error `timeout` isn't included in Node.js yet
113+ t . throws ( ( ) => AbortSignal . timeout ( ) , {
113114 instanceOf : TypeError ,
114115 message :
115116 "Failed to execute 'timeout' on 'AbortSignal': parameter 1 is not of type 'integer'." ,
116- } ;
117- // @ts -expect-error `timeout` isn't included in Node.js yet
118- t . throws ( ( ) => AbortSignal . timeout ( ) , expectations ) ;
119- // @ts -expect-error `timeout` isn't included in Node.js yet
120- t . throws ( ( ) => AbortSignal . timeout ( "42" ) , expectations ) ;
117+ } ) ;
118+ // @ts -expect-error this is valid in the real Workers runtime
119+ AbortSignal . timeout ( undefined ) ;
120+ // @ts -expect-error this is valid in the real Workers runtime
121+ // noinspection TypeScriptValidateJSTypes
122+ AbortSignal . timeout ( "1" ) ;
121123} ) ;
122124test ( "AbortSignal.timeout: included on constructor obtained via AbortController#signal prototype" , ( t ) => {
123125 const controller = new AbortController ( ) ;
@@ -153,13 +155,14 @@ test("scheduler.wait: does nothing if aborted after resolve", async (t) => {
153155 controller . abort ( ) ;
154156 t . pass ( ) ;
155157} ) ;
156- test ( "scheduler.wait: requires numeric timeout" , ( t ) => {
157- const expectations : ThrowsExpectation = {
158+ test ( "scheduler.wait: requires numeric timeout" , async ( t ) => {
159+ t . throws ( ( ) => scheduler . wait ( ) , {
158160 instanceOf : TypeError ,
159161 message :
160162 "Failed to execute 'wait' on 'Scheduler': parameter 1 is not of type 'integer'." ,
161- } ;
162- t . throws ( ( ) => scheduler . wait ( ) , expectations ) ;
163- // @ts -expect-error `timeout` isn't included in Node.js yet
164- t . throws ( ( ) => scheduler . wait ( "42" ) , expectations ) ;
163+ } ) ;
164+ await scheduler . wait ( undefined ) ;
165+ // @ts -expect-error this is valid in the real Workers runtime
166+ // noinspection TypeScriptValidateJSTypes
167+ await scheduler . wait ( "1" ) ;
165168} ) ;
0 commit comments