Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova Lib Release Preparation (Cordova 9) #749

Merged
merged 15 commits into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration-tests/HooksRunner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('HooksRunner', function () {
describe('plugin hooks', function () {
it('Test 011 : should filter hook scripts from plugin.xml by platform', function () {
// Make scripts executable
globby.sync('scripts/**', {cwd: testPluginInstalledPath, absolute: true})
globby.sync('scripts/**', { cwd: testPluginInstalledPath, absolute: true })
.forEach(f => fs.chmodSync(f, 0o755));

usePluginConfig('TwoPlatforms');
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/fetch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('end-to-end plugin dependency tests', function () {
return cordova.create(preparedProject)
.then(function () {
process.chdir(preparedProject);
return cordova.platform('add', 'android');
return cordova.platform('add', 'android', { save: true });
});
});

Expand Down Expand Up @@ -85,7 +85,7 @@ describe('end-to-end plugin dependency tests', function () {
})
.then(function () {
expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
return cordova.plugin('add', plugins['Test1'], {'force': true});
return cordova.plugin('add', plugins['Test1'], { 'force': true });
})
.then(function () {
expect(path.join(pluginsDir, 'Test1')).toExist();
Expand Down
62 changes: 31 additions & 31 deletions integration-tests/pkgJson.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ describe('pkgJson', function () {
return {
pass, message: `expected ${version} ${expectation} ${spec}`
};
}}),
} }),
tohaveMinSatisfyingVersion: () => ({ compare (spec, version) {
const pass = specWithMinSatisfyingVersion(version).asymmetricMatch(spec);
const expectation = (pass ? 'not ' : '') + 'to have minimal satisfying version';
return {
pass, message: `expected ${spec} ${expectation} ${version}`
};
}})
} })
};

// Add our custom matchers
Expand All @@ -150,7 +150,7 @@ describe('pkgJson', function () {
expect(getPkgJson('cordova')).toBeUndefined();

// Add the plugin with --save.
return cordova.plugin('add', `${pluginId}@1.1.2`, {save: true})
return cordova.plugin('add', `${pluginId}@1.1.2`, { save: true })
.then(function () {
// Check that the plugin and spec add was successful to pkg.json.
expect(getPkgJson('cordova.plugins')[pluginId]).toBeDefined();
Expand All @@ -161,7 +161,7 @@ describe('pkgJson', function () {
]);
}).then(function () {
// And now remove it with --save.
return cordova.plugin('rm', pluginId, {save: true});
return cordova.plugin('rm', pluginId, { save: true });
}).then(function () {
// Expect plugin to be removed from pkg.json.
expect(getPkgJson('cordova.plugins')[pluginId]).toBeUndefined();
Expand All @@ -174,7 +174,7 @@ describe('pkgJson', function () {
expect(pkgJsonPath).toExist();

// Add the geolocation plugin with --save.
return cordova.plugin('add', SAVED_PLUGIN, {save: true})
return cordova.plugin('add', SAVED_PLUGIN, { save: true })
.then(function () {
// Add a second plugin without save.
return cordova.plugin('add', pluginId);
Expand All @@ -190,7 +190,7 @@ describe('pkgJson', function () {
expect(pkgJsonPath).toExist();

// Add the plugin with --save.
return cordova.plugin('add', pluginId, {save: true})
return cordova.plugin('add', pluginId, { save: true })
.then(function () {
expect(getPkgJson('cordova.plugins')).toEqual({
[pluginId]: {}
Expand All @@ -210,15 +210,15 @@ describe('pkgJson', function () {
expect(pkgJsonPath).toExist();

// Add the plugin with --save.
return cordova.plugin('add', pluginId, {save: true, cli_variables: {someKey: 'someValue'}})
return cordova.plugin('add', pluginId, { save: true, cli_variables: { someKey: 'someValue' } })
.then(function () {
// Check the plugin add was successful and that variables have been added too.
expect(getPkgJson('cordova.plugins')).toEqual({
[pluginId]: {someKey: 'someValue'}
[pluginId]: { someKey: 'someValue' }
});
}).then(function () {
// And now remove it with --save.
return cordova.plugin('rm', pluginId, {save: true});
return cordova.plugin('rm', pluginId, { save: true });
}).then(function () {
// Checking that the plugin and variables were removed successfully.
expect(getPkgJson('cordova.plugins')).toEqual({});
Expand All @@ -230,7 +230,7 @@ describe('pkgJson', function () {
expect(pkgJsonPath).toExist();

// Add the plugin with --save.
return cordova.plugin('add', [pluginId, OTHER_PLUGIN], {save: true})
return cordova.plugin('add', [pluginId, OTHER_PLUGIN], { save: true })
.then(function () {
// Check that the plugin add was successful.
expect(getPkgJson('cordova.plugins')).toEqual({
Expand All @@ -242,7 +242,7 @@ describe('pkgJson', function () {
});
}).then(function () {
// And now remove it with --save.
return cordova.plugin('rm', [pluginId, OTHER_PLUGIN], {save: true});
return cordova.plugin('rm', [pluginId, OTHER_PLUGIN], { save: true });
}).then(function () {
// Checking that the plugin removed is in not in the platforms.
expect(getPkgJson('cordova.plugins')).toEqual({});
Expand All @@ -264,7 +264,7 @@ describe('pkgJson', function () {
expect(getCfg().getEngines()).toEqual([]);
expect(getCfg().getPluginIdList()).toEqual([]);

return cordova.platform('add', PLATFORM, {save: true})
return cordova.platform('add', PLATFORM, { save: true })
.then(function () {
expect(getPkgJson('cordova.platforms')).toEqual([PLATFORM]);

Expand All @@ -274,7 +274,7 @@ describe('pkgJson', function () {
spec: specSatisfiedBy(platformVersion(PLATFORM))
}]);
}).then(function () {
return cordova.plugin('add', PLUGIN, {save: true});
return cordova.plugin('add', PLUGIN, { save: true });
}).then(function () {
const iosJson = fs.readJsonSync(path.join(project, 'platforms/ios/ios.json'));
expect(iosJson.installed_plugins[PLUGIN]).toBeDefined();
Expand All @@ -294,7 +294,7 @@ describe('pkgJson', function () {
const platformPath = copyFixture(`platforms/cordova-${PLATFORM}`);
const pluginPath = copyFixture(path.join('plugins', PLUGIN));

return cordova.platform('add', platformPath, {save: true})
return cordova.platform('add', platformPath, { save: true })
.then(function () {
// Pkg.json has platform
expect(getPkgJson('cordova.platforms')).toEqual([PLATFORM]);
Expand All @@ -306,7 +306,7 @@ describe('pkgJson', function () {
]);
}).then(function () {
// Run cordova plugin add local path --save --fetch.
return cordova.plugin('add', pluginPath, {save: true});
return cordova.plugin('add', pluginPath, { save: true });
}).then(function () {
// Pkg.json has test plugin.
expect(getPkgJson(`cordova.plugins.${PLUGIN}`)).toBeDefined();
Expand All @@ -331,13 +331,13 @@ describe('pkgJson', function () {
expect(installedPlatforms()).toEqual([]);

// Add the testing platform with --save.
return cordova.platform('add', testPlatform, {save: true}).then(function () {
return cordova.platform('add', testPlatform, { save: true }).then(function () {
// Check the platform add was successful.
expect(installedPlatforms()).toEqual([testPlatform]);
expect(getPkgJson('cordova.platforms')).toEqual([testPlatform]);
}).then(function () {
// And now remove it with --save.
return cordova.platform('rm', testPlatform, {save: true});
return cordova.platform('rm', testPlatform, { save: true });
}).then(function () {
// Checking that the platform removed is in not in the platforms key.
expect(getPkgJson('cordova.platforms')).toEqual([]);
Expand All @@ -349,7 +349,7 @@ describe('pkgJson', function () {
expect(installedPlatforms()).toEqual([]);

// Add the testing platform with --save.
return cordova.platform('add', testPlatform, {save: true}).then(function () {
return cordova.platform('add', testPlatform, { save: true }).then(function () {
// Check the platform add was successful.
expect(installedPlatforms()).toEqual([testPlatform]);
expect(getPkgJson('cordova.platforms')).toEqual([testPlatform]);
Expand Down Expand Up @@ -384,7 +384,7 @@ describe('pkgJson', function () {
return cordova.platform('add', platformNotToAdd)
.then(function () {
// And now add another platform with --save.
return cordova.platform('add', testPlatform, {save: true});
return cordova.platform('add', testPlatform, { save: true });
}).then(function () {
// Check that only the platform added with --save was added to package.json.
expect(getPkgJson('cordova.platforms')).toEqual([testPlatform]);
Expand All @@ -398,7 +398,7 @@ describe('pkgJson', function () {
expect(installedPlatforms()).toEqual([]);

// Add the testing platform with --save and add specific version to android platform.
return cordova.platform('add', ['[email protected]', '[email protected]'], {save: true}).then(function () {
return cordova.platform('add', ['[email protected]', '[email protected]'], { save: true }).then(function () {
expect(installedPlatforms()).toEqual(['android', 'browser']);

// Check the platform add was successful in platforms list and
Expand All @@ -416,7 +416,7 @@ describe('pkgJson', function () {
]);
}).then(function () {
// And now remove it with --save.
return cordova.platform('rm', ['android', 'browser'], {save: true});
return cordova.platform('rm', ['android', 'browser'], { save: true });
}).then(function () {
// Expect platforms to be uninstalled & removed from config files
expect(getPkgJson('cordova.platforms')).toEqual([]);
Expand Down Expand Up @@ -451,19 +451,19 @@ describe('pkgJson', function () {

expect(installedPlatforms()).toEqual([]);

return cordova.platform('add', PLATFORM, {save: true}).then(function () {
return cordova.platform('add', PLATFORM, { save: true }).then(function () {
// No change to pkg.json platforms or spec for ios.
expect(getPkgJson('cordova.platforms')).toEqual([ PLATFORM ]);
// Config.xml and ios/cordova/version check.
const version = platformVersion(PLATFORM);
expect(getCfg().getEngines()).toEqual([
{name: PLATFORM, spec: specSatisfiedBy(version)}
{ name: PLATFORM, spec: specSatisfiedBy(version) }
]);
// Check that pkg.json and ios/cordova/version versions "satisfy" each other.
const pkgSpec = getPkgJson(`dependencies.cordova-${PLATFORM}`);
expect(version).toSatisfy(pkgSpec);
}).then(function () {
return cordova.plugin('add', PLUGIN, {save: true});
return cordova.plugin('add', PLUGIN, { save: true });
}).then(function () {
// Check that installed version satisfies the dependency spec
expect(pluginVersion(PLUGIN)).toSatisfy(getPkgJson(`dependencies.${PLUGIN}`));
Expand All @@ -486,8 +486,8 @@ describe('pkgJson', function () {
expect(installedPlatforms()).toEqual([]);

// Remove for testing purposes so platform is not pre-installed.
return cordova.platform('rm', PLATFORM, {save: true}).then(function () {
return cordova.platform('add', PLATFORM, {save: true});
return cordova.platform('rm', PLATFORM, { save: true }).then(function () {
return cordova.platform('add', PLATFORM, { save: true });
}).then(function () {
// pkg.json has new platform.
expect(getPkgJson('cordova.platforms')).toEqual([PLATFORM]);
Expand All @@ -497,7 +497,7 @@ describe('pkgJson', function () {
spec: specSatisfiedBy(platformVersion(PLATFORM))
}]);
}).then(function () {
return cordova.plugin('add', PLUGIN, {save: true});
return cordova.plugin('add', PLUGIN, { save: true });
}).then(function () {
expect(getCfg().getPlugins()).toEqual([{
name: PLUGIN,
Expand Down Expand Up @@ -532,7 +532,7 @@ describe('pkgJson', function () {

expect(installedPlatforms()).toEqual([]);

return cordova.platform('add', `${PLATFORM}@4.5.4`, {save: true}).then(function () {
return cordova.platform('add', `${PLATFORM}@4.5.4`, { save: true }).then(function () {
// Pkg.json has ios.
expect(getPkgJson('cordova.platforms')).toEqual([ PLATFORM ]);
// Config.xml and ios/cordova/version check.
Expand All @@ -541,7 +541,7 @@ describe('pkgJson', function () {
spec: specSatisfiedBy(platformVersion(PLATFORM))
}]);
}).then(function () {
return cordova.plugin('add', `${PLUGIN}@4.0.0`, {save: true});
return cordova.plugin('add', `${PLUGIN}@4.0.0`, { save: true });
}).then(function () {
// Check that installed version satisfies the dependency spec
const version = pluginVersion(PLUGIN);
Expand All @@ -560,7 +560,7 @@ describe('pkgJson', function () {
const PLATFORM = 'browser';
const platformPath = copyFixture(`platforms/cordova-${PLATFORM}`);

return cordova.platform('add', platformPath, {save: true})
return cordova.platform('add', platformPath, { save: true })
.then(function () {
expect(getCfg().getEngines()).toContain({
name: 'browser', spec: stringContaining(platformPath)
Expand All @@ -573,7 +573,7 @@ describe('pkgJson', function () {
const PLUGIN = 'cordova-lib-test-plugin';
const pluginPath = copyFixture(path.join('plugins', PLUGIN));

return cordova.plugin('add', pluginPath, {save: true})
return cordova.plugin('add', pluginPath, { save: true })
.then(function () {
expect(getCfg().getPlugins()).toContain({
name: PLUGIN,
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/platform.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('cordova/platform end-to-end', () => {
it('Test 007 : should add and remove platform from node_modules directory', () => {
return Promise.resolve()
.then(() => {
return cordova.platform('add', 'browser', {'save': true});
return cordova.platform('add', 'browser', { 'save': true });
})
.then(() => {
expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
Expand Down Expand Up @@ -157,14 +157,14 @@ describe('cordova/platform end-to-end', () => {
return cordova.platform('add', testPlatform);
})
.then(() => {
return cordova.plugin('add', 'cordova-plugin-media', {save: true});
return cordova.plugin('add', 'cordova-plugin-media', { save: true });
})
.then(() => {
expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
expect(path.join(nodeModulesDir, 'cordova-plugin-media')).toExist();
expect(path.join(nodeModulesDir, 'cordova-plugin-file')).toExist();
return cordova.plugin('rm', 'cordova-plugin-media', {save: true});
return cordova.plugin('rm', 'cordova-plugin-media', { save: true });
})
.then(() => {
expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ describe('plugin end-to-end', function () {
}, 30000);

it('Test 006 : should successfully add a plugin when specifying CLI variables', function () {
return addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes' }});
return addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, { cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes' } });
}, 30000);

it('Test 007 : should not check npm info when using the searchpath flag', function () {
mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
spyOn(plugin_util, 'info');
return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir})
return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, { searchpath: pluginsDir })
.then(function () {
expect(plugin_util.info).not.toHaveBeenCalled();
var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
Expand All @@ -191,7 +191,7 @@ describe('plugin end-to-end', function () {
mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));

spyOn(plugin_util, 'info');
return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry: true})
return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, { noregistry: true })
.then(function () {
expect(plugin_util.info).not.toHaveBeenCalled();

Expand Down
Loading