From c40d9934aa5851db859aac060b4e31f75e231aaf Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 4 Feb 2020 15:48:17 +0100 Subject: [PATCH] chore(cli): fix tests for newer node versions (#2403) --- cli/test/util.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/test/util.ts b/cli/test/util.ts index ef54507075..539f204e91 100644 --- a/cli/test/util.ts +++ b/cli/test/util.ts @@ -88,7 +88,10 @@ export async function makeAppDir(monoRepoLike: boolean = false) { await runCommand(`cd "${rootDir}" && npm install --save ${corePath} ${cliPath}`); // Make a fake cordova plugin - await makeCordovaPlugin(appDir); + const cordovaPluginPath = join(tmpDir, CORDOVA_PLUGIN_ID); + await makeCordovaPlugin(cordovaPluginPath); + + await runCommand(`cd "${rootDir}" && npm install --save ${cordovaPluginPath}`); return { ...appDirObj, @@ -180,14 +183,13 @@ Pod::Spec.new do |s| s.dependency 'CapacitorCordova' end`; -async function makeCordovaPlugin(appDir: string) { - const cordovaPluginPath = join(appDir, 'node_modules', CORDOVA_PLUGIN_ID); +async function makeCordovaPlugin(cordovaPluginPath: string) { const iosPath = join(cordovaPluginPath, 'src', 'ios'); const androidPath = join(cordovaPluginPath, 'android/com/getcapacitor'); await mkdirs(cordovaPluginPath); await writeFileAsync(join(cordovaPluginPath, 'plugin.js'), CODOVA_PLUGIN_JS); await writeFileAsync(join(cordovaPluginPath, 'plugin.xml'), CORDOVA_PLUGIN_XML); - await writeFileAsync(join(cordovaPluginPath, 'package.json'), JSON.stringify(CORDOVA_PLUGIN_PACKAGE)); + await writeFileAsync(join(cordovaPluginPath, 'package.json'), CORDOVA_PLUGIN_PACKAGE); await mkdirs(iosPath); await mkdirs(androidPath); await writeFileAsync(join(iosPath, 'CoolPlugin.m'), '');