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

test(pkgJson): make expectations work for npm 5 to 7 #865

Merged
merged 1 commit into from
Dec 16, 2020
Merged
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
7 changes: 4 additions & 3 deletions integration-tests/pkgJson.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,15 @@ describe('pkgJson', function () {
});

it('Test#026 : should successfully add a plugin with git/semver combo', async () => {
const URL = 'https://github.com/apache/cordova-plugin-device.git#semver:2.0.x';
const TAG = '#semver:2.0.x';
const URL = `https://github.com/apache/cordova-plugin-device.git${TAG}`;

expect(getPkgJson('cordova.plugins')).toBeUndefined();
expect(getPkgJson(`devDependencies.${pluginId}`)).toBeUndefined();

await cordova.plugin('add', URL, { save: true });
expect(getPkgJson('cordova.plugins')[pluginId]).toBeDefined();
expect(getPkgJson('devDependencies')[pluginId]).toMatch(URL);
expect(getPkgJson('devDependencies')[pluginId]).toContain(TAG);
});
});

Expand Down Expand Up @@ -389,7 +390,7 @@ describe('pkgJson', function () {
}).then(function () {
// Expect platforms to be uninstalled & removed from config files
expect(getPkgJson('cordova.platforms')).toEqual([]);
expect(getPkgJson('devDependencies')).toEqual({});
expect(getPkgJson('devDependencies') || {}).toEqual({});
expect(getCfg().getEngines()).toEqual([]);
expect(installedPlatforms()).toEqual([]);
});
Expand Down