Skip to content

Commit

Permalink
chore(cli): fix tests for newer node versions (#2403)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Feb 4, 2020
1 parent ce93ed3 commit c40d993
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cli/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'), '');
Expand Down

0 comments on commit c40d993

Please sign in to comment.