@@ -27,6 +27,13 @@ import { IndexedDbTransactionError } from '../../../src/local/simple_db';
27
27
28
28
use ( chaiAsPromised ) ;
29
29
30
+ function isSafari ( ) : boolean {
31
+ return (
32
+ navigator . userAgent . includes ( 'Safari' ) &&
33
+ ! navigator . userAgent . includes ( 'Chrome' )
34
+ ) ;
35
+ }
36
+
30
37
describe ( 'AsyncQueue' , ( ) => {
31
38
// We reuse these TimerIds for generic testing.
32
39
const timerId1 = TimerId . ListenStreamConnectionBackoff ;
@@ -137,14 +144,21 @@ describe('AsyncQueue', () => {
137
144
} ) ;
138
145
} ) ;
139
146
140
- it ( 'can schedule ops in the future' , async ( ) => {
147
+ // Flaky on Safari.
148
+ // eslint-disable-next-line no-restricted-properties
149
+ ( isSafari ( ) ? it . skip : it ) ( 'can schedule ops in the future' , async ( ) => {
150
+ if (
151
+ navigator . userAgent . includes ( 'Safari' ) &&
152
+ ! navigator . userAgent . includes ( 'Chrome' )
153
+ ) {
154
+ return ;
155
+ }
141
156
const queue = new AsyncQueue ( ) ;
142
157
const completedSteps : number [ ] = [ ] ;
143
158
const doStep = ( n : number ) : Promise < number > =>
144
159
defer ( ( ) => completedSteps . push ( n ) ) ;
145
160
queue . enqueueAndForget ( ( ) => doStep ( 1 ) ) ;
146
- // Flaky on Safari, increasing delay to 1000ms to try to increase reliability.
147
- const last = queue . enqueueAfterDelay ( timerId1 , 1000 , ( ) => doStep ( 4 ) ) ;
161
+ const last = queue . enqueueAfterDelay ( timerId1 , 5 , ( ) => doStep ( 4 ) ) ;
148
162
// eslint-disable-next-line @typescript-eslint/no-floating-promises
149
163
queue . enqueueAfterDelay ( timerId2 , 1 , ( ) => doStep ( 3 ) ) ;
150
164
queue . enqueueAndForget ( ( ) => doStep ( 2 ) ) ;
0 commit comments