fix: ensure Application instance initialized early (#10315)

This commit is contained in:
Igor Randjelovic
2023-06-15 19:30:13 +02:00
committed by GitHub
parent e430555cb2
commit 0401b09a43
2 changed files with 6 additions and 0 deletions

View File

@ -370,3 +370,6 @@ function isTestingEnv() {
if (!global.NativeScriptHasInitGlobal && !isTestingEnv()) { if (!global.NativeScriptHasInitGlobal && !isTestingEnv()) {
initGlobal(); initGlobal();
} }
// ensure the Application instance is initialized before any other module imports it.
require('@nativescript/core/application');

View File

@ -1,4 +1,7 @@
// @ts-nocheck // @ts-nocheck
jest.mock('@nativescript/core/application', () => null, { virtual: true });
global.__DEV__ = true; global.__DEV__ = true;
global.WeakRef.prototype.get = global.WeakRef.prototype.deref; global.WeakRef.prototype.get = global.WeakRef.prototype.deref;
global.NativeClass = function () {}; global.NativeClass = function () {};