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/16 23:15:27 UTC

[GitHub] [cordova-android] raphinesse commented on a change in pull request #783: Do not clobber globals with test mocks

raphinesse commented on a change in pull request #783: Do not clobber globals with test mocks
URL: https://github.com/apache/cordova-android/pull/783#discussion_r304164395
 
 

 ##########
 File path: spec/unit/run.spec.js
 ##########
 @@ -201,14 +201,7 @@ describe('run', () => {
     describe('help', () => {
         it('should print out usage and help', () => {
             spyOn(console, 'log');
-
-            // Rewiring the process object in entirety does not work on NodeJS 12.
-            // Rewiring members of process however does work
-            // https://github.com/apache/cordova-android/issues/768
-            // https://github.com/jhnns/rewire/issues/167
-            run.__set__('process.exit', _ => null);
-            run.__set__('process.cwd', _ => '');
-            run.__set__('process.argv', ['', '']);
+            spyOn(process, 'exit');
 
 Review comment:
   I get your surprise. I've been there myself. However, there are at least 170 instances of `spyOn` calls that do not specify a spy strategy (and thus are stubs) in the Cordova projects I have checked out locally, alone. I really don't want to start commenting them all.

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