You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/17 00:15:38 UTC

[GitHub] [cordova-android] brodybits edited a comment on issue #784: Properly handle promise in create script

brodybits edited a comment on issue #784: Properly handle promise in create script
URL: https://github.com/apache/cordova-android/pull/784#issuecomment-512046902
 
 
   > The `validateProjectName` failure tests never execute that code. It's part of `exports.create`. The tests for `exports.create` OTOH stub `validateProjectName` and only verify that it has been called. So this couldn't have failed any of the existing tests.
   
   Hmm, I think we should add a test to cover this case.
   
   If I would ignore this PR and inject the following change onto the `master` branch in my workarea:
   
   ```diff
   diff --git a/bin/lib/create.js b/bin/lib/create.js
   index 2fa457fa..623b655b 100755
   --- a/bin/lib/create.js
   +++ b/bin/lib/create.js
   @@ -273,6 +273,7 @@ exports.create = function (project_path, config, options, events) {
        return exports.validatePackageName(package_name)
            .then(function () {
                exports.validateProjectName(project_name);
   +            return Q.resolve();
            }).then(function () {
            // Log the given values for the project
                events.emit('log', 'Creating Cordova project for the Android platform:');
   ```
   
   then `npm test` seems to succeed for me. What do you think?
   
   Extra P.S. (unrelated): With the following cleanup changes, `npm test` passes for me back to Node.js 6:
   
   ```diff
   diff --git a/bin/lib/create.js b/bin/lib/create.js
   index 3c4b8373..2cc0726d 100755
   --- a/bin/lib/create.js
   +++ b/bin/lib/create.js
   @@ -271,9 +271,8 @@ exports.create = function (project_path, config, options, events) {
    
        // Make the package conform to Java package types
        return exports.validatePackageName(package_name)
   -        .then(function () {
   -            return exports.validateProjectName(project_name);
   -        }).then(function () {
   +        .then(() => (exports.validateProjectName(project_name)))
   +        .then(() => {
            // Log the given values for the project
                events.emit('log', 'Creating Cordova project for the Android platform:');
                events.emit('log', '\tPath: ' + project_path);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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