You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2020/12/16 22:05:42 UTC

[cordova-lib] branch master updated: test(pkgJson): make expectations work for npm 5 to 7 (#865)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new ef18688  test(pkgJson): make expectations work for npm 5 to 7 (#865)
ef18688 is described below

commit ef1868884164a0838da66bd97503a0a1903e0bcd
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Wed Dec 16 23:05:31 2020 +0100

    test(pkgJson): make expectations work for npm 5 to 7 (#865)
    
    This addresses the following changes in behavior.
    
    Saved GitHub URL format in package.json:
    - npm 6: git+https://github.com/apache/cordova-android.git#4.1.x
    - npm 7: github:apache/cordova-android#4.1.x
    
    Empty devDependencies format in package.json:
    - npm 6: `{}`
    - npm 7: `undefined`
---
 integration-tests/pkgJson.spec.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index bc1d4e6..6240363 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -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);
         });
     });
 
@@ -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([]);
             });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org