From 00403633f46d8c87841aeca299836e128fb2d284 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 4 Sep 2015 11:19:46 +0300 Subject: [PATCH] Run cocoapods test on darwin Currently npm test shows this warning on OSX - "Skipping Cocoapods tests. They cannot work on windows" --- lib/services/ios-project-service.ts | 2 +- test/ios-project-service.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 85736ef068..1fb326cc04 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -461,7 +461,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ let projectPodFileContent = this.$fs.readText(this.projectPodFilePath).wait(); let contentToRemove= this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent); projectPodFileContent = helpers.stringReplaceAll(projectPodFileContent, contentToRemove, ""); - if(_.isEmpty(projectPodFileContent)) { + if(projectPodFileContent.trim() === "use_frameworks!") { this.$fs.deleteFile(this.projectPodFilePath).wait(); } else { this.$fs.writeFile(this.projectPodFilePath, projectPodFileContent).wait(); diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index cbc01b4081..6d89180c62 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -37,12 +37,13 @@ function createTestInjector(projectPath: string, projectName: string): IInjector }); testInjector.register("projectHelper", {}); testInjector.register("staticConfig", ConfigLib.StaticConfig); + testInjector.register("projectDataService", {}); return testInjector; } describe("Cocoapods support", () => { - if (require("os").platform !== "darwin") { + if (require("os").platform() !== "darwin") { console.log("Skipping Cocoapods tests. They cannot work on windows"); } else { it("adds plugin with Podfile", () => { @@ -68,7 +69,7 @@ describe("Cocoapods support", () => { fs.createDirectory(platformsFolderPath).wait(); let iOSProjectService = testInjector.resolve("iOSProjectService"); - iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { + iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { return Future.fromResult(); }; @@ -90,7 +91,8 @@ describe("Cocoapods support", () => { assert.isTrue(fs.exists(projectPodfilePath).wait()); let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait(); - let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `, + let expectedProjectPodfileContent = ["use_frameworks!", + `# Begin Podfile - ${pluginPodfilePath} `, ` ${pluginPodfileContent} `, " # End Podfile \n"] .join("\n"); @@ -119,10 +121,10 @@ describe("Cocoapods support", () => { fs.createDirectory(platformsFolderPath).wait(); let iOSProjectService = testInjector.resolve("iOSProjectService"); - iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { + iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { return Future.fromResult(); }; - iOSProjectService.removeDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { + iOSProjectService.removeFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture => { return Future.fromResult(); }; @@ -144,7 +146,8 @@ describe("Cocoapods support", () => { assert.isTrue(fs.exists(projectPodfilePath).wait()); let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait(); - let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `, + let expectedProjectPodfileContent = ["use_frameworks!", + `# Begin Podfile - ${pluginPodfilePath} `, ` ${pluginPodfileContent} `, " # End Podfile \n"] .join("\n");