How to use the nativescript/lib/common/yok.Yok function in nativescript

To help you get started, we’ve selected a few nativescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NativeScript / nativescript-cloud / test / mobile / mobile-core / cloud-emulator-device-discovery.ts View on Github external
function createTestInjector(devices?: IAttachedDevices): IInjector {
			const customEventEmitter = new CustomDeviceEmitter(devices);
			const testInjector = new Yok();
			testInjector.register("injector", testInjector);
			testInjector.register("nsCloudDeviceEmulator", {
				get deviceEmitter() {
					return customEventEmitter;
				}
			});
			testInjector.register("nsCloudServerEmulatorsService", { /* empty */ });
			testInjector.register("mobileHelper", {
				normalizePlatformName: (platform: string) => platform.toLowerCase()
			});

			return testInjector;
		}
github NativeScript / nativescript-cloud / test / services / cloud-emulator-service.ts View on Github external
function createTestInjector(): IInjector {
			const testInjector = new Yok();
			testInjector.register("nsCloudServerRequestService", {
				call: async () => emulatorCredentials
			});
			testInjector.register("fs", {
				exists: () => true,
				readJson: () => ({}),
				writeJson: () => { /* empty */ }
			});
			testInjector.register("nsCloudUploadService", {
				uploadToS3: async (url: string) => url
			});
			testInjector.register("nsCloudDeviceEmulator", { /* empty */ });
			testInjector.register("options", {
				profileDir: "test"
			});
			testInjector.register("nsCloudEulaService", {
github NativeScript / nativescript-cloud / test / commands / cloud-build.ts View on Github external
it("returns the real version of the package", async () => {
		const testInjector = new Yok();
		testInjector.register("fs", FileSystem);
		let message: string = null;
		const loggerInfo = (msg: string) => {
			message = msg;
		};

		testInjector.register("logger", {
			info: loggerInfo
		});

		testInjector.register("nsCloudPackageInfoService", PackageInfoService);
		testInjector.registerCommand("command", CloudLibVersion);

		await testInjector.resolveCommand("command").execute([]);

		const realVersion = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "package.json")).toString()).version;
github NativeScript / nativescript-cloud / test / commands / eula-command-helper.ts View on Github external
const createTestInjector = (): IInjector => {
		const testInjector = new Yok();
		testInjector.register("nsCloudErrorsService", {
			fail: (message: string, ...args: any[]): never => { throw new Error(message); }
		});

		testInjector.register("logger", {
			printMarkdown: (...args: any[]): void => undefined,
			trace: (formatStr?: any, ...args: any[]): void => undefined,
			info: (formatStr?: any, ...args: any[]): void => undefined,
		});

		testInjector.register("nsCloudEulaService", {
			acceptEula: async (): Promise => undefined,
			getEulaDataWithCache: async (): Promise => ({ url: EulaConstants.eulaUrl, shouldAcceptEula: true })
		});

		testInjector.register("prompter", {
github NativeScript / nativescript-cloud / test / services / version-service.ts View on Github external
const createTestInjector = (cloudConfigurationData?:  ICloudConfigurationData): IInjector => {
		const testInjector = new Yok();
		testInjector.register("logger", {
			trace: (formatStr?: any, ...args: any[]): void => (undefined)
		});
		testInjector.register("httpClient", {});
		testInjector.register("nsCloudConfigurationService", {
			getCloudConfigurationData: () => cloudConfigurationData
		});
		testInjector.register("nsCloudPolyfillService", PolyfillService);
		testInjector.register("projectDataService", {});
		return testInjector;
	};
github NativeScript / nativescript-cloud / test / cloud-operation / communication / communication-channel-factory.ts View on Github external
const createTestInjector = (): IInjector => {
		const testInjector = new Yok();

		testInjector.register("logger", {});
		testInjector.register("nsCloudCommunicationChannelFactory", CommunicationChannelFactory);
		testInjector.register("nsCloudWebSocketFactory", {
			create: (): any => null
		});
		testInjector.register("injector", testInjector);

		return testInjector;
	};
	beforeEach(() => {

nativescript

Command-line interface for building NativeScript projects

Apache-2.0
Latest version published 22 days ago

Package Health Score

84 / 100
Full package analysis