diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index 4d2217c508..cddbfb8ada 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -24,15 +24,15 @@ await this.$platformService.trackProjectType(this.$projectData); if (this.$options.start) { - return this.$debugLiveSyncService.printDebugInformation(await this.debugService.debug(debugData, debugOptions)); + return this.$debugLiveSyncService.printDebugInformation(await this.debugService.debug(debugData, debugOptions)); } this.$config.debugLivesync = true; await this.$devicesService.detectCurrentlyAttachedDevices(); - const devices = this.$devicesService.getDeviceInstances(); // Now let's take data for each device: + const devices = this.$devicesService.getDeviceInstances(); const deviceDescriptors: ILiveSyncDeviceInfo[] = devices.filter(d => !this.platform || d.deviceInfo.platform === this.platform) .map(d => { const info: ILiveSyncDeviceInfo = { @@ -91,10 +91,7 @@ } if (this.$devicesService.deviceCount > 1) { - // Starting debugger on emulator. - this.$options.emulator = true; - - this.$logger.warn("Multiple devices found! Starting debugger on emulator. If you want to debug on specific device please select device with --device option.".yellow.bold); + this.$errors.failWithoutHelp("Multiple devices found! To debug on specific device please select device with --device option."); } return true; diff --git a/lib/common b/lib/common index d5e8675ed3..8be9f921aa 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit d5e8675ed30da6f096643ff1aac4c6d2ec18b46f +Subproject commit 8be9f921aa50000405af9ded63c770da7910d741 diff --git a/lib/constants.ts b/lib/constants.ts index 7da59a05a0..31c19aead4 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -79,7 +79,7 @@ export class LiveSyncPaths { static FULLSYNC_DIR_NAME = "fullsync"; static IOS_DEVICE_PROJECT_ROOT_PATH = "Library/Application Support/LiveSync"; static IOS_DEVICE_SYNC_ZIP_PATH = "Library/Application Support/LiveSync/sync.zip"; -}; +} export const ANGULAR_NAME = "angular"; export const TYPESCRIPT_NAME = "typescript"; export const BUILD_OUTPUT_EVENT_NAME = "buildOutput"; diff --git a/lib/definitions/debug.d.ts b/lib/definitions/debug.d.ts index 916fd9e391..04008db7ae 100644 --- a/lib/definitions/debug.d.ts +++ b/lib/definitions/debug.d.ts @@ -96,7 +96,7 @@ interface IDebugServiceBase extends NodeJS.EventEmitter { * @param {IDebugOptions} debugOptions Describe possible options to modify the behaivor of the debug operation, for example stop on the first line. * @returns {Promise} Array of URLs that can be used for debugging or a string representing a single url that can be used for debugging. */ - debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise; + debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise; } interface IDebugService { diff --git a/lib/definitions/livesync.d.ts b/lib/definitions/livesync.d.ts index e936c86d56..6fa8ae0691 100644 --- a/lib/definitions/livesync.d.ts +++ b/lib/definitions/livesync.d.ts @@ -174,7 +174,7 @@ interface IDebugLiveSyncService extends ILiveSyncService { * @param {string[]} information Array of information to be printed. Note that false-like values will be stripped from the array. * @returns {void} */ - printDebugInformation(information: string[]): void; + printDebugInformation(information: string): void; } interface ILiveSyncWatchInfo { diff --git a/lib/services/android-debug-service.ts b/lib/services/android-debug-service.ts index 54c59b2f1b..04713f1752 100644 --- a/lib/services/android-debug-service.ts +++ b/lib/services/android-debug-service.ts @@ -18,17 +18,17 @@ class AndroidDebugService extends DebugServiceBase implements IPlatformDebugServ this._device = newDevice; } - constructor(private $devicesService: Mobile.IDevicesService, + constructor(protected $devicesService: Mobile.IDevicesService, private $errors: IErrors, private $logger: ILogger, private $config: IConfiguration, private $androidDeviceDiscovery: Mobile.IDeviceDiscovery, private $androidProcessService: Mobile.IAndroidProcessService, private $net: INet) { - super(); + super($devicesService); } - public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise { return debugOptions.emulator ? this.debugOnEmulator(debugData, debugOptions) : this.debugOnDevice(debugData, debugOptions); @@ -49,7 +49,7 @@ class AndroidDebugService extends DebugServiceBase implements IPlatformDebugServ return; } - private async debugOnEmulator(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + private async debugOnEmulator(debugData: IDebugData, debugOptions: IDebugOptions): Promise { // Assure we've detected the emulator as device // For example in case deployOnEmulator had stated new emulator instance // we need some time to detect it. Let's force detection. @@ -82,7 +82,7 @@ class AndroidDebugService extends DebugServiceBase implements IPlatformDebugServ return this.device.adb.executeCommand(["forward", `tcp:${local}`, `localabstract:${remote}`]); } - private async debugOnDevice(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + private async debugOnDevice(debugData: IDebugData, debugOptions: IDebugOptions): Promise { let packageFile = ""; if (!debugOptions.start && !debugOptions.emulator) { @@ -94,9 +94,8 @@ class AndroidDebugService extends DebugServiceBase implements IPlatformDebugServ let action = (device: Mobile.IAndroidDevice): Promise => this.debugCore(device, packageFile, debugData.applicationIdentifier, debugOptions); - const result = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); - - return _.map(result, r => r.result); + const deviceActionResult = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); + return deviceActionResult[0].result; } private async debugCore(device: Mobile.IAndroidDevice, packageFile: string, packageName: string, debugOptions: IDebugOptions): Promise { diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 60c8708cda..170bae39d9 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -171,7 +171,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject this.$errors.failWithoutHelp(`Your project have installed ${dependency.name} version ${cleanedVerson} but Android platform requires version ${dependency.version}.`); } } - }; + } } private cleanResValues(targetSdkVersion: number, projectData: IProjectData, frameworkVersion: string): void { diff --git a/lib/services/debug-service-base.ts b/lib/services/debug-service-base.ts index 417c080454..8dec2fa5fe 100644 --- a/lib/services/debug-service-base.ts +++ b/lib/services/debug-service-base.ts @@ -1,9 +1,11 @@ import { EventEmitter } from "events"; export abstract class DebugServiceBase extends EventEmitter implements IPlatformDebugService { + constructor(protected $devicesService: Mobile.IDevicesService) { super(); } + public abstract get platform(): string; - public abstract async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise; + public abstract async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise; public abstract async debugStart(debugData: IDebugData, debugOptions: IDebugOptions): Promise; @@ -12,7 +14,8 @@ export abstract class DebugServiceBase extends EventEmitter implements IPlatform protected getCanExecuteAction(deviceIdentifier: string): (device: Mobile.IDevice) => boolean { return (device: Mobile.IDevice): boolean => { if (deviceIdentifier) { - return device.deviceInfo.identifier === deviceIdentifier; + return device.deviceInfo.identifier === deviceIdentifier + || device.deviceInfo.identifier === this.$devicesService.getDeviceByDeviceOption().deviceInfo.identifier; } else { return true; } diff --git a/lib/services/debug-service.ts b/lib/services/debug-service.ts index dda56ac784..b1ec3b850f 100644 --- a/lib/services/debug-service.ts +++ b/lib/services/debug-service.ts @@ -36,7 +36,7 @@ export class DebugService extends EventEmitter implements IDebugService { // For now we can only check if app is running on Android. // After we find a way to check on iOS we should use it here. const isAppRunning = true; - let result: string[]; + let result: string; debugOptions.chrome = true; const debugService = this.getDebugService(device); @@ -59,9 +59,9 @@ export class DebugService extends EventEmitter implements IDebugService { this.$errors.failWithoutHelp(`Debugging on iOS devices is not supported for ${platform()} yet.`); } - result = await debugService.debug(debugData, debugOptions); + result = await debugService.debug(debugData, debugOptions); } else if (this.$mobileHelper.isAndroidPlatform(device.deviceInfo.platform)) { - result = await debugService.debug(debugData, debugOptions); + result = await debugService.debug(debugData, debugOptions); } return _.first(result); diff --git a/lib/services/init-service.ts b/lib/services/init-service.ts index f60751fa83..84358a67e9 100644 --- a/lib/services/init-service.ts +++ b/lib/services/init-service.ts @@ -56,7 +56,7 @@ export class InitService implements IInitService { projectData[this.$staticConfig.CLIENT_NAME_KEY_IN_PROJECT_FILE][platformData.frameworkPackageName] = _.extend(currentPlatformData, await this.getVersionData(platformData.frameworkPackageName)); } - }; + } } let dependencies = projectData.dependencies; diff --git a/lib/services/ios-debug-service.ts b/lib/services/ios-debug-service.ts index 60600caaf6..b120065040 100644 --- a/lib/services/ios-debug-service.ts +++ b/lib/services/ios-debug-service.ts @@ -21,9 +21,9 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService private _childProcess: ChildProcess; private _socketProxy: any; - constructor(private $platformService: IPlatformService, + constructor(protected $devicesService: Mobile.IDevicesService, + private $platformService: IPlatformService, private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices, - private $devicesService: Mobile.IDevicesService, private $childProcess: IChildProcess, private $logger: ILogger, private $errors: IErrors, @@ -32,7 +32,7 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService private $iOSSocketRequestExecutor: IiOSSocketRequestExecutor, private $processService: IProcessService, private $socketProxyFactory: ISocketProxyFactory) { - super(); + super($devicesService); this.$processService.attachToProcessExitSignals(this, this.debugStop); this.$socketProxyFactory.on(CONNECTION_ERROR_EVENT_NAME, (e: Error) => this.emit(CONNECTION_ERROR_EVENT_NAME, e)); } @@ -41,7 +41,7 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService return "ios"; } - public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise { if (debugOptions.debugBrk && debugOptions.start) { this.$errors.failWithoutHelp("Expected exactly one of the --debug-brk or --start options."); } @@ -52,9 +52,9 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService if (debugOptions.emulator) { if (debugOptions.start) { - return [await this.emulatorStart(debugData, debugOptions)]; + return await this.emulatorStart(debugData, debugOptions); } else { - return [await this.emulatorDebugBrk(debugData, debugOptions)]; + return await this.emulatorDebugBrk(debugData, debugOptions); } } else { if (debugOptions.start) { @@ -149,7 +149,7 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService return result; } - private async deviceDebugBrk(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + private async deviceDebugBrk(debugData: IDebugData, debugOptions: IDebugOptions): Promise { await this.$devicesService.initialize({ platform: this.platform, deviceId: debugData.deviceIdentifier }); const action = async (device: iOSDevice.IOSDevice) => { if (device.isEmulator) { @@ -171,8 +171,8 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService return result; }; - const results = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); - return _.map(results, r => r.result); + const deviceActionResult = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); + return deviceActionResult[0].result; } private async debugBrkCore(device: Mobile.IiOSDevice, debugData: IDebugData, debugOptions: IDebugOptions): Promise { @@ -180,11 +180,11 @@ class IOSDebugService extends DebugServiceBase implements IPlatformDebugService return this.wireDebuggerClient(debugData, debugOptions, device); } - private async deviceStart(debugData: IDebugData, debugOptions: IDebugOptions): Promise { + private async deviceStart(debugData: IDebugData, debugOptions: IDebugOptions): Promise { await this.$devicesService.initialize({ platform: this.platform, deviceId: debugData.deviceIdentifier }); const action = async (device: Mobile.IiOSDevice) => device.isEmulator ? await this.emulatorStart(debugData, debugOptions) : await this.deviceStartCore(device, debugData, debugOptions); - const results = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); - return _.map(results, r => r.result); + const deviceActionResult = await this.$devicesService.execute(action, this.getCanExecuteAction(debugData.deviceIdentifier)); + return deviceActionResult[0].result; } private async deviceStartCore(device: Mobile.IiOSDevice, debugData: IDebugData, debugOptions: IDebugOptions): Promise { diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 2d6d966e00..b46b6e89b7 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -933,7 +933,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f private getAllLibsForPluginWithFileExtension(pluginData: IPluginData, fileExtension: string): string[] { let filterCallback = (fileName: string, pluginPlatformsFolderPath: string) => path.extname(fileName) === fileExtension; return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback); - }; + } private buildPathToCurrentXcodeProjectFile(projectData: IProjectData): string { return path.join(projectData.platformsDir, "ios", `${projectData.projectName}.xcodeproj`, "project.pbxproj"); diff --git a/lib/services/livesync/debug-livesync-service.ts b/lib/services/livesync/debug-livesync-service.ts index cf3dac408e..3d8354b2c8 100644 --- a/lib/services/livesync/debug-livesync-service.ts +++ b/lib/services/livesync/debug-livesync-service.ts @@ -52,7 +52,7 @@ export class DebugLiveSyncService extends LiveSyncService implements IDebugLiveS await this.$platformService.trackProjectType(this.$projectData); if (this.$options.start) { - return this.printDebugInformation(await debugService.debug(debugData, debugOptions)); + return this.printDebugInformation(await debugService.debug(debugData, debugOptions)); } const deviceAppData = liveSyncResultInfo.deviceAppData; @@ -66,14 +66,13 @@ export class DebugLiveSyncService extends LiveSyncService implements IDebugLiveS const buildConfig: IBuildConfig = _.merge({ buildForDevice: !deviceAppData.device.isEmulator }, deployOptions); debugData.pathToAppPackage = this.$platformService.lastOutputPath(debugService.platform, buildConfig, projectData); - this.printDebugInformation(await debugService.debug(debugData, debugOptions)); + this.printDebugInformation(await debugService.debug(debugData, debugOptions)); } - public printDebugInformation(information: string[]): void { - information = information.filter(i => !!i); - _.each(information, i => { - this.$logger.info(`To start debugging, open the following URL in Chrome:${EOL}${i}${EOL}`.cyan); - }); + public printDebugInformation(information: string): void { + if (!!information) { + this.$logger.info(`To start debugging, open the following URL in Chrome:${EOL}${information}${EOL}`.cyan); + } } } diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index f1a3bd5b94..fb68a435b6 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -73,7 +73,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { let version: string; if (currentPlatformData && currentPlatformData[constants.VERSION_STRING]) { version = currentPlatformData[constants.VERSION_STRING]; - }; + } return version; } @@ -669,7 +669,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } else { await this.addPlatform(platformParam, platformTemplate, projectData, config); } - }; + } } private getCanExecuteAction(platform: string, options: IDeviceEmulator): any { diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index df436d5e9d..38faf585e5 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -280,7 +280,7 @@ export class PluginsService implements IPluginsService { let pluginDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, "tns_modules"); await action(pluginDestinationPath, platform.toLowerCase(), platformData); } - }; + } } private getInstalledFrameworkVersion(platform: string, projectData: IProjectData): string { diff --git a/lib/services/xcconfig-service.ts b/lib/services/xcconfig-service.ts index 63fb6b2fca..d6fcb658ea 100644 --- a/lib/services/xcconfig-service.ts +++ b/lib/services/xcconfig-service.ts @@ -4,7 +4,7 @@ export class XCConfigService { /** * Returns the Value of a Property from a XC Config file. - * @param xcconfigFilePath + * @param xcconfigFilePath * @param propertyName */ public readPropertyValue(xcconfigFilePath: string, propertyName: string): string { diff --git a/package.json b/package.json index a99f1db36e..fbd777cb85 100644 --- a/package.json +++ b/package.json @@ -81,30 +81,29 @@ }, "analyze": true, "devDependencies": { - "@types/chai": "3.4.34", - "@types/chai-as-promised": "0.0.29", + "@types/chai": "4.0.1", + "@types/chai-as-promised": "0.0.31", "@types/chokidar": "1.6.0", - "@types/lodash": "4.14.50", "@types/node": "6.0.61", "@types/qr-image": "3.2.0", - "@types/request": "0.0.42", + "@types/request": "0.0.45", "@types/semver": "^5.3.31", "@types/source-map": "0.5.0", - "chai": "3.5.0", - "chai-as-promised": "6.0.0", + "chai": "4.0.2", + "chai-as-promised": "7.0.0", "grunt": "1.0.1", "grunt-contrib-clean": "1.0.0", "grunt-contrib-copy": "1.0.0", "grunt-contrib-watch": "1.0.0", "grunt-shell": "1.3.0", - "grunt-ts": "6.0.0-beta.6", - "grunt-tslint": "4.0.0", + "grunt-ts": "6.0.0-beta.16", + "grunt-tslint": "5.0.1", "istanbul": "0.4.5", "mocha": "3.1.2", "should": "7.0.2", "source-map-support": "^0.4.14", - "tslint": "4.3.1", - "typescript": "2.1.4" + "tslint": "5.4.3", + "typescript": "2.4.1" }, "license": "Apache-2.0", "engines": { diff --git a/test/ios-entitlements-service.ts b/test/ios-entitlements-service.ts index b3e99093be..5c9f950531 100644 --- a/test/ios-entitlements-service.ts +++ b/test/ios-entitlements-service.ts @@ -29,7 +29,7 @@ describe("IOSEntitlements Service Tests", () => { testInjector.register("errors", ErrorsLib.Errors); testInjector.register("pluginsService", { - getAllInstalledPlugins: async () => [] + getAllInstalledPlugins: async (): Promise => [] }); return testInjector; @@ -137,8 +137,8 @@ describe("IOSEntitlements Service Tests", () => { it("Merge uses the entitlements file from a Plugin", async () => { let pluginsService = injector.resolve("pluginsService"); - let testPluginFolderPath = temp.mkdirSync("testPlugin"); - pluginsService.getAllInstalledPlugins = async() => [{ + let testPluginFolderPath = temp.mkdirSync("testPlugin"); + pluginsService.getAllInstalledPlugins = async () => [{ pluginPlatformsFolderPath: (platform: string) => { return testPluginFolderPath; } @@ -161,8 +161,8 @@ describe("IOSEntitlements Service Tests", () => { // setup plugin entitlements let pluginsService = injector.resolve("pluginsService"); - let testPluginFolderPath = temp.mkdirSync("testPlugin"); - pluginsService.getAllInstalledPlugins = async() => [{ + let testPluginFolderPath = temp.mkdirSync("testPlugin"); + pluginsService.getAllInstalledPlugins = async () => [{ pluginPlatformsFolderPath: (platform: string) => { return testPluginFolderPath; } diff --git a/test/platform-commands.ts b/test/platform-commands.ts index 63288c0261..cf7ff0e1e8 100644 --- a/test/platform-commands.ts +++ b/test/platform-commands.ts @@ -35,7 +35,7 @@ class PlatformData implements IPlatformData { emulatorServices: Mobile.IEmulatorPlatformServices = null; projectRoot = ""; deviceBuildOutputPath = ""; - getValidPackageNames = (buildOptions: {isForDevice?: boolean, isReleaseBuild?: boolean}) => [""]; + getValidPackageNames = (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => [""]; validPackageNamesForDevice: string[] = []; frameworkFilesExtensions = [".jar", ".dat"]; appDestinationDirectoryPath = ""; @@ -126,7 +126,7 @@ function createTestInjector() { prepareNodeModulesFolder: () => { /* intentionally left blank */ } }); testInjector.register("pluginsService", { - getAllInstalledPlugins: async () => [] + getAllInstalledPlugins: async (): Promise => [] }); testInjector.register("projectFilesManager", ProjectFilesManagerLib.ProjectFilesManager); testInjector.register("hooksService", stubs.HooksServiceStub); @@ -143,7 +143,7 @@ function createTestInjector() { testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService); testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService); testInjector.register("analyticsService", { - track: async () => undefined + track: async () => async (): Promise => undefined }); testInjector.register("messages", Messages); testInjector.register("devicePathProvider", {}); diff --git a/test/platform-service.ts b/test/platform-service.ts index e4ce0e5352..94ae456ac5 100644 --- a/test/platform-service.ts +++ b/test/platform-service.ts @@ -81,7 +81,7 @@ function createTestInjector() { testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService); testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService); testInjector.register("analyticsService", { - track: async () => undefined + track: async (): Promise => undefined }); testInjector.register("messages", Messages); testInjector.register("devicePathProvider", {}); diff --git a/test/plugins-service.ts b/test/plugins-service.ts index fa21aa9b98..4cad62b65b 100644 --- a/test/plugins-service.ts +++ b/test/plugins-service.ts @@ -137,9 +137,7 @@ async function addPluginWhenExpectingToFail(testInjector: IInjector, plugin: str let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; pluginsService.ensureAllDependenciesAreInstalled = () => { return Promise.resolve(); @@ -210,9 +208,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projData: IProjectData) => { - return [{ - name: "plugin1" - }]; + return [{ name: "plugin1" }]; }; mockBeginCommand(testInjector, "Exception: " + 'Plugin "plugin1" is already installed.'); @@ -260,9 +256,7 @@ describe("Plugins service", () => { let projectData: IProjectData = testInjector.resolve("projectData"); projectData.initializeProjectData(); pluginsService.getAllInstalledPlugins = async (projData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; // Mock platformsData @@ -285,9 +279,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; let commandsService = testInjector.resolve(CommandsService); @@ -320,9 +312,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; let commandsService = testInjector.resolve(CommandsService); @@ -368,9 +358,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; let commandsService = testInjector.resolve(CommandsService); @@ -411,9 +399,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; // Mock options @@ -451,9 +437,7 @@ describe("Plugins service", () => { let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; // Mock options @@ -494,9 +478,7 @@ describe("Plugins service", () => { // Mock plugins service let pluginsService: IPluginsService = testInjector.resolve("pluginsService"); pluginsService.getAllInstalledPlugins = async (projectData: IProjectData) => { - return [{ - name: "" - }]; + return [{ name: "" }]; }; let appDestinationDirectoryPath = path.join(projectFolder, "platforms", "android"); diff --git a/test/project-templates-service.ts b/test/project-templates-service.ts index 6ec449d736..ac46ac405c 100644 --- a/test/project-templates-service.ts +++ b/test/project-templates-service.ts @@ -50,7 +50,7 @@ function createTestInjector(configuration?: { shouldNpmInstallThrow: boolean, np injector.register("projectTemplatesService", ProjectTemplatesService); - injector.register("analyticsService", { track: async () => undefined }); + injector.register("analyticsService", { track: async (): Promise => undefined }); return injector; } diff --git a/test/services/debug-service.ts b/test/services/debug-service.ts index ea5224621c..f23fa11be8 100644 --- a/test/services/debug-service.ts +++ b/test/services/debug-service.ts @@ -11,7 +11,7 @@ class PlatformDebugService extends EventEmitter /* implements IPlatformDebugServ public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise { return [fakeChromeDebugUrl]; } -}; +} interface IDebugTestDeviceInfo { deviceInfo: { @@ -20,7 +20,7 @@ interface IDebugTestDeviceInfo { }; isEmulator: boolean; -}; +} interface IDebugTestData { isDeviceFound: boolean; @@ -30,7 +30,7 @@ interface IDebugTestData { isWindows: boolean; isDarwin: boolean; }; -}; +} const getDefaultDeviceInformation = (platform?: string): IDebugTestDeviceInfo => ({ deviceInfo: { diff --git a/test/services/extensibility-service.ts b/test/services/extensibility-service.ts index dc2e7d42c9..a03138676f 100644 --- a/test/services/extensibility-service.ts +++ b/test/services/extensibility-service.ts @@ -251,7 +251,7 @@ describe("extensibilityService", () => { assert.deepEqual(err.message, expectedResults[index].message); assert.deepEqual(err.extensionName, extensionNames[index]); }); - }; + } }); it("rejects all promises when unable to read node_modules dir (simulate EPERM error)", async () => { @@ -287,7 +287,7 @@ describe("extensibilityService", () => { assert.deepEqual(err.message, `Unable to load extension ${extensionName}. You will not be able to use the functionality that it adds. Error: ${expectedErrorMessage}`); assert.deepEqual(err.extensionName, extensionName); }); - }; + } assert.deepEqual(promises.length, extensionNames.length); assert.isTrue(isReadDirCalled, "readDirectory should have been called for the extensions."); @@ -340,7 +340,7 @@ describe("extensibilityService", () => { assert.deepEqual(err.message, `Unable to load extension ${extensionName}. You will not be able to use the functionality that it adds. Error: ${expectedErrorMessages[index]}`); assert.deepEqual(err.extensionName, extensionName); }); - }; + } assert.deepEqual(promises.length, extensionNames.length); assert.isTrue(isNpmInstallCalled, "Npm install should have been called for the extensions."); diff --git a/test/services/subscription-service.ts b/test/services/subscription-service.ts index da01584f13..ac2106ad0c 100644 --- a/test/services/subscription-service.ts +++ b/test/services/subscription-service.ts @@ -9,7 +9,7 @@ interface IValidateTestData { name: string; valuePassedToValidate: string; expectedResult: boolean | string; -}; +} const createTestInjector = (): IInjector => { const testInjector = new Yok(); diff --git a/test/stubs.ts b/test/stubs.ts index f16b5b0016..2948172aa6 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -178,10 +178,6 @@ export class FileSystemStub implements IFileSystem { } export class ErrorsStub implements IErrors { - constructor() { - new (require("../lib/common/errors").Errors)(); // we need the side effect of require'ing errors - } - fail(formatStr: string, ...args: any[]): void; fail(opts: { formatStr?: string; errorCode?: number; suppressCommandHelp?: boolean }, ...args: any[]): void; @@ -210,7 +206,7 @@ export class ErrorsStub implements IErrors { } export class NpmInstallationManagerStub implements INpmInstallationManager { - async install(packageName: string, pathToSave?: string, version?: string): Promise { + async install(packageName: string, pathToSave?: string, options?: INpmInstallOptions ): Promise { return Promise.resolve(""); } @@ -481,7 +477,7 @@ function unexpected(msg: string): Error { } export class DebugServiceStub extends EventEmitter implements IPlatformDebugService { - public async debug(): Promise { + public async debug(): Promise { return; } diff --git a/test/tools/node-modules/node-modules-dependencies-builder.ts b/test/tools/node-modules/node-modules-dependencies-builder.ts index fb25057a12..8b25691fde 100644 --- a/test/tools/node-modules/node-modules-dependencies-builder.ts +++ b/test/tools/node-modules/node-modules-dependencies-builder.ts @@ -10,7 +10,7 @@ interface IDependencyInfo { depth: number; dependencies?: IDependencyInfo[]; nativescript?: any; -}; +} // TODO: Add integration tests. // The tests assumes npm 3 or later is used, so all dependencies (and their dependencies) will be installed at the root node_modules diff --git a/test/xcconfig-service.ts b/test/xcconfig-service.ts index 099ee44b47..ba9e13a330 100644 --- a/test/xcconfig-service.ts +++ b/test/xcconfig-service.ts @@ -57,7 +57,7 @@ describe("XCConfig Service Tests", () => { fs.readText = (filename: string, options?: IReadFileOptions | string): string => { return `// You can add custom settings here // for example you can uncomment the following line to force distribution code signing - CODE_SIGN_IDENTITY = iPhone Distribution + CODE_SIGN_IDENTITY = iPhone Distribution // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html // DEVELOPMENT_TEAM = YOUR_TEAM_ID; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -79,7 +79,7 @@ describe("XCConfig Service Tests", () => { fs.readText = (filename: string, options?: IReadFileOptions | string): string => { return `// You can add custom settings here // for example you can uncomment the following line to force distribution code signing - CODE_SIGN_IDENTITY = iPhone Distribution + CODE_SIGN_IDENTITY = iPhone Distribution // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html // DEVELOPMENT_TEAM = YOUR_TEAM_ID ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon