File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,12 @@ function withGlobal(_global) {
206
206
}
207
207
208
208
const NativeDate = _global . Date ;
209
- const NativeIntl = _global . Intl ;
209
+ const NativeIntl = isPresent . Intl
210
+ ? Object . defineProperties (
211
+ Object . create ( null ) ,
212
+ Object . getOwnPropertyDescriptors ( _global . Intl ) ,
213
+ )
214
+ : undefined ;
210
215
let uniqueTimerId = idCounterStart ;
211
216
212
217
if ( NativeDate === undefined ) {
@@ -1107,7 +1112,7 @@ function withGlobal(_global) {
1107
1112
}
1108
1113
1109
1114
if ( isPresent . Intl ) {
1110
- timers . Intl = _global . Intl ;
1115
+ timers . Intl = NativeIntl ;
1111
1116
}
1112
1117
1113
1118
const originalSetTimeout = _global . setImmediate || _global . setTimeout ;
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ const { FakeTimers } = require ( "./helpers/setup-tests" ) ;
4
+
5
+ describe ( "issue #516 - not resilient to changes on Intl" , function ( ) {
6
+ it ( "should successfully install the timer" , function ( ) {
7
+ const originalIntlProperties = Object . getOwnPropertyDescriptors (
8
+ global . Intl ,
9
+ ) ;
10
+ for ( const key of Object . keys ( originalIntlProperties ) ) {
11
+ delete global . Intl [ key ] ;
12
+ }
13
+ try {
14
+ const clock = FakeTimers . createClock ( ) ;
15
+ clock . tick ( 16 ) ;
16
+ } finally {
17
+ Object . defineProperties ( global . Intl , originalIntlProperties ) ;
18
+ }
19
+ } ) ;
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments