Skip to content

Commit c40d993

Browse files
authored
chore(cli): fix tests for newer node versions (#2403)
1 parent ce93ed3 commit c40d993

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cli/test/util.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export async function makeAppDir(monoRepoLike: boolean = false) {
8888
await runCommand(`cd "${rootDir}" && npm install --save ${corePath} ${cliPath}`);
8989

9090
// Make a fake cordova plugin
91-
await makeCordovaPlugin(appDir);
91+
const cordovaPluginPath = join(tmpDir, CORDOVA_PLUGIN_ID);
92+
await makeCordovaPlugin(cordovaPluginPath);
93+
94+
await runCommand(`cd "${rootDir}" && npm install --save ${cordovaPluginPath}`);
9295

9396
return {
9497
...appDirObj,
@@ -180,14 +183,13 @@ Pod::Spec.new do |s|
180183
s.dependency 'CapacitorCordova'
181184
end`;
182185

183-
async function makeCordovaPlugin(appDir: string) {
184-
const cordovaPluginPath = join(appDir, 'node_modules', CORDOVA_PLUGIN_ID);
186+
async function makeCordovaPlugin(cordovaPluginPath: string) {
185187
const iosPath = join(cordovaPluginPath, 'src', 'ios');
186188
const androidPath = join(cordovaPluginPath, 'android/com/getcapacitor');
187189
await mkdirs(cordovaPluginPath);
188190
await writeFileAsync(join(cordovaPluginPath, 'plugin.js'), CODOVA_PLUGIN_JS);
189191
await writeFileAsync(join(cordovaPluginPath, 'plugin.xml'), CORDOVA_PLUGIN_XML);
190-
await writeFileAsync(join(cordovaPluginPath, 'package.json'), JSON.stringify(CORDOVA_PLUGIN_PACKAGE));
192+
await writeFileAsync(join(cordovaPluginPath, 'package.json'), CORDOVA_PLUGIN_PACKAGE);
191193
await mkdirs(iosPath);
192194
await mkdirs(androidPath);
193195
await writeFileAsync(join(iosPath, 'CoolPlugin.m'), '');

0 commit comments

Comments
 (0)