@@ -16,7 +16,9 @@ describe("timeout", () => {
16
16
try {
17
17
await timeout ( updateInterval , maxDuration , action ) ;
18
18
} catch ( e ) {
19
- expect ( e ) . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
19
+ expect ( e ) . toBe (
20
+ `Action timed out after ${ maxDuration } ms. Last rejection reason was: false.` ,
21
+ ) ;
20
22
}
21
23
const end = Date . now ( ) ;
22
24
@@ -37,7 +39,9 @@ describe("timeout", () => {
37
39
try {
38
40
await timeout ( updateInterval , maxDuration , action ) ;
39
41
} catch ( e ) {
40
- expect ( e ) . toEqual ( `Action timed out after ${ maxDuration } ms` ) ;
42
+ expect ( e ) . toEqual (
43
+ `Action timed out after ${ maxDuration } ms. Didn't receive a result within timeout.` ,
44
+ ) ;
41
45
}
42
46
const end = Date . now ( ) ;
43
47
@@ -90,7 +94,7 @@ describe("timeout", () => {
90
94
const action = jest . fn ( ( ) => {
91
95
const interval = Date . now ( ) - start ;
92
96
return new Promise < boolean > ( ( resolve , reject ) =>
93
- interval > delay ? resolve ( true ) : reject ( )
97
+ interval > delay ? resolve ( true ) : reject ( ) ,
94
98
) ;
95
99
} ) ;
96
100
@@ -114,7 +118,9 @@ describe("timeout", () => {
114
118
try {
115
119
await timeout ( updateInterval , maxDuration , action ) ;
116
120
} catch ( e ) {
117
- expect ( e ) . toEqual ( `Action timed out after ${ maxDuration } ms` ) ;
121
+ expect ( e ) . toEqual (
122
+ `Action timed out after ${ maxDuration } ms. Didn't receive a result within timeout.` ,
123
+ ) ;
118
124
}
119
125
const end = Date . now ( ) ;
120
126
@@ -137,7 +143,9 @@ describe("timeout", () => {
137
143
const SUT = ( ) => timeout ( updateInterval , maxDuration , action ) ;
138
144
139
145
// THEN
140
- await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
146
+ await expect ( SUT ) . rejects . toBe (
147
+ `Action timed out after ${ maxDuration } ms. Didn't receive a result within timeout.` ,
148
+ ) ;
141
149
expect ( action ) . toBeCalledTimes ( 1 ) ;
142
150
} ) ;
143
151
@@ -157,7 +165,9 @@ describe("timeout", () => {
157
165
const SUT = ( ) => timeout ( updateInterval , maxDuration , action ) ;
158
166
159
167
// THEN
160
- await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
168
+ await expect ( SUT ) . rejects . toBe (
169
+ `Action timed out after ${ maxDuration } ms. Didn't receive a result within timeout.` ,
170
+ ) ;
161
171
expect ( action ) . toBeCalledTimes ( 1 ) ;
162
172
await sleep ( 500 ) ;
163
173
expect ( action ) . toBeCalledTimes ( 1 ) ;
0 commit comments