File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/core/test/tracing/integrations Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ import { NATIVE } from '../../../src/js/wrapper';
3333import { getDefaultTestClientOptions , TestClient } from '../../mocks/client' ;
3434import { mockFunction } from '../../testutils' ;
3535
36+ let dateNowSpy : jest . SpyInstance ;
37+
3638jest . mock ( '../../../src/js/wrapper' , ( ) => {
3739 return {
3840 NATIVE : {
@@ -1057,6 +1059,9 @@ function mockTooOldAppStart() {
10571059function mockReactNativeBundleExecutionStartTimestamp ( ) {
10581060 RN_GLOBAL_OBJ . nativePerformanceNow = ( ) => 100 ; // monotonic clock like `performance.now()`
10591061 RN_GLOBAL_OBJ . __BUNDLE_START_TIME__ = 50 ; // 50ms after time origin
1062+
1063+ const currentTimeMilliseconds = Date . now ( ) ;
1064+ dateNowSpy = jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => currentTimeMilliseconds ) ;
10601065}
10611066
10621067/**
@@ -1065,6 +1070,10 @@ function mockReactNativeBundleExecutionStartTimestamp() {
10651070function clearReactNativeBundleExecutionStartTimestamp ( ) {
10661071 delete RN_GLOBAL_OBJ . nativePerformanceNow ;
10671072 delete RN_GLOBAL_OBJ . __BUNDLE_START_TIME__ ;
1073+
1074+ if ( dateNowSpy ) {
1075+ dateNowSpy . mockRestore ( ) ;
1076+ }
10681077}
10691078
10701079function set__DEV__ ( value : boolean ) {
You can’t perform that action at this time.
0 commit comments