You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/07/15 15:21:32 UTC

[GitHub] [cordova-electron] brodybits commented on a change in pull request #156: refactor: remove more platform-centered code and files

brodybits commented on a change in pull request #156:
URL: https://github.com/apache/cordova-electron/pull/156#discussion_r455133996



##########
File path: tests/spec/unit/lib/Api.spec.js
##########
@@ -95,6 +95,15 @@ describe('Api class', () => {
             expect(api.root).toEqual(testProjectDir);
             expect(api.locations).toEqual(jasmine.objectContaining(mockExpectedLocations));
         });
+
+        it('should throw error when the constructor is missing platformRootDir argument.', () => {
+            expect(() => new Api()).toThrowError(CordovaError, 'The path to the platform root directory was undefined or invalid.');

Review comment:
       Prettier would reformat like this:
   
   ```suggestion
               expect(() => new Api()).toThrowError(
                 CordovaError,
                 "The path to the platform root directory was undefined or invalid."
               );
   ```
   
   (<https://prettier.io/playground/>)

##########
File path: lib/Api.js
##########
@@ -51,8 +51,10 @@ class Api {
     constructor (platform, platformRootDir, events) {
         this.platform = 'electron';
 
-        // MyApp/platforms/electron
-        this.root = platformRootDir || path.resolve(__dirname, '../bin/templates');
+        // The path to the platform root directory must always be provided.
+        if (!platformRootDir || !fs.existsSync(platformRootDir)) throw new CordovaError('The path to the platform root directory was undefined or invalid.');

Review comment:
       I think this line is too long.




----------------------------------------------------------------
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



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