@@ -11,7 +11,8 @@ import { module, test } from 'qunit';
11
11
import EmberObject , { get } from '@ember/object' ;
12
12
import { DEBUG } from '@glimmer/env' ;
13
13
14
- import { task as taskFn , TaskGenerator , didCancel } from 'ember-concurrency' ;
14
+ import { task as taskFn , didCancel } from 'ember-concurrency' ;
15
+ import type { TaskGenerator } from 'ember-concurrency' ;
15
16
// type resolution is not working correctly due to usage of forked
16
17
// (non-published) ember-concurrency-decorators remove this ts-ignore when
17
18
// migrating back to mainline off the fork
@@ -33,13 +34,13 @@ interface ModeDef {
33
34
}
34
35
35
36
if ( DEBUG ) {
36
- module ( 'wait-for' , function ( hooks ) {
37
- hooks . afterEach ( function ( ) {
37
+ module ( 'wait-for' , function ( hooks ) {
38
+ hooks . afterEach ( function ( ) {
38
39
_reset ( ) ;
39
40
resetError ( ) ;
40
41
} ) ;
41
42
const generatorTestModules = [
42
- ( function ( ) {
43
+ ( function ( ) {
43
44
const EmberObjectThing = EmberObject . extend ( {
44
45
doStuffTask : taskFn (
45
46
waitFor ( function * doTaskStuff ( ...args : any ) {
@@ -90,6 +91,7 @@ if (DEBUG) {
90
91
throw new Error ( 'doh!' ) ;
91
92
}
92
93
asyncThrow ( ...args : any ) {
94
+ // @ts -expect-error throwingTask missing, due to `this` not having its type changed
93
95
return perform ( this . throwingTask , ...args ) ;
94
96
}
95
97
}
@@ -106,14 +108,16 @@ if (DEBUG) {
106
108
107
109
testModules . forEach (
108
110
( { name, waiterName, EmberObjectThing, NativeThing } ) => {
109
- module ( name , function ( ) {
111
+ module ( name , function ( ) {
110
112
const invocationType = [
111
113
{
112
114
name : 'class function' ,
113
115
createPromise ( ...args : any [ ] ) {
116
+ // @ts -expect-error - doAsyncStuff missing due to TS being hard to use with the old (pre)class model
114
117
return EmberObjectThing . create ( ) . doAsyncStuff ( ...args ) ;
115
118
} ,
116
119
createThrowingPromise ( ) {
120
+ // @ts -expect-error - asyncThrow missing due to TS being hard to use with the old (pre)class model
117
121
return EmberObjectThing . create ( ) . asyncThrow ( ) ;
118
122
} ,
119
123
} ,
@@ -130,8 +134,8 @@ if (DEBUG) {
130
134
131
135
invocationType . forEach (
132
136
( { name, createPromise, createThrowingPromise } : ModeDef ) => {
133
- module ( name , function ( ) {
134
- test ( 'waitFor wraps and registers a waiter' , async function ( assert ) {
137
+ module ( name , function ( ) {
138
+ test ( 'waitFor wraps and registers a waiter' , async function ( assert ) {
135
139
overrideError ( MockStableError ) ;
136
140
137
141
const promise = createPromise ( ) ;
@@ -158,14 +162,14 @@ if (DEBUG) {
158
162
} ) ;
159
163
} ) ;
160
164
161
- test ( 'waitFor handles arguments and return value' , async function ( assert ) {
165
+ test ( 'waitFor handles arguments and return value' , async function ( assert ) {
162
166
overrideError ( MockStableError ) ;
163
167
164
168
const ret = await createPromise ( 1 , 'foo' ) ;
165
169
assert . deepEqual ( ret , [ 'foo' , 1 ] ) ;
166
170
} ) ;
167
171
168
- test ( 'waitFor transitions waiter to not pending even if promise throws when thenable wrapped' , async function ( assert ) {
172
+ test ( 'waitFor transitions waiter to not pending even if promise throws when thenable wrapped' , async function ( assert ) {
169
173
const promise = createThrowingPromise ( ) ;
170
174
171
175
try {
@@ -184,7 +188,7 @@ if (DEBUG) {
184
188
} ,
185
189
) ;
186
190
187
- module ( 'waitFor ember-concurrency interop' , function ( ) {
191
+ module ( 'waitFor ember-concurrency interop' , function ( ) {
188
192
class Deferred {
189
193
promise : Promise < any > ;
190
194
resolve : Function = ( ) => null ;
@@ -262,7 +266,7 @@ if (DEBUG) {
262
266
}
263
267
}
264
268
265
- test ( 'tasks with multiple yields work' , async function ( assert ) {
269
+ test ( 'tasks with multiple yields work' , async function ( assert ) {
266
270
const thing = new NativeThing ( ) ;
267
271
const task = perform ( thing . doStuffTask ) ;
268
272
@@ -295,7 +299,7 @@ if (DEBUG) {
295
299
] ;
296
300
297
301
cancellationCases . forEach ( ( { desc, taskName } ) => {
298
- test ( `${ desc } task cancellation works` , async function ( assert ) {
302
+ test ( `${ desc } task cancellation works` , async function ( assert ) {
299
303
const thing = new NativeThing ( ) ;
300
304
301
305
const instance = perform ( get ( thing , taskName ) ) ;
@@ -317,7 +321,7 @@ if (DEBUG) {
317
321
} ) ;
318
322
} ) ;
319
323
320
- module ( 'waitFor co interop' , function ( ) {
324
+ module ( 'waitFor co interop' , function ( ) {
321
325
function coDec (
322
326
_target : object ,
323
327
_key : string ,
@@ -391,7 +395,7 @@ if (DEBUG) {
391
395
}
392
396
}
393
397
394
- test ( 'it works' , async function ( assert ) {
398
+ test ( 'it works' , async function ( assert ) {
395
399
const thing = new NativeThing ( ) ;
396
400
397
401
thing . doStuffCo ( ) ;
@@ -412,7 +416,7 @@ if (DEBUG) {
412
416
} ) ;
413
417
} ) ;
414
418
415
- test ( 'types' , async function ( assert ) {
419
+ test ( 'types' , async function ( assert ) {
416
420
assert . expect ( 0 ) ;
417
421
418
422
async function asyncFn ( a : string , b : string ) {
0 commit comments