Skip to content

Commit

Permalink
rewire workaround for NodeJS 12 (#774)
Browse files Browse the repository at this point in the history
* rewire workaround for NodeJS 12

* additional comment with a link to the underlying issue in jhnns/rewire#167
  • Loading branch information
breautek authored and Chris Brody committed Jul 12, 2019
1 parent 4b9e18c commit 38c6627
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec/unit/run.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,15 @@ describe('run', () => {
it('should print out usage and help', () => {
const logSpy = jasmine.createSpy();
const errorSpy = jasmine.createSpy();
const procStub = { exit: _ => null, cwd: _ => '', argv: ['', ''] };
run.__set__({ console: { log: logSpy, error: errorSpy }, process: procStub });
run.__set__({ console: { log: logSpy, error: errorSpy } });

// 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', ['', '']);

run.help();
expect(logSpy).toHaveBeenCalledWith(jasmine.stringMatching(/^Usage:/));
Expand Down

0 comments on commit 38c6627

Please sign in to comment.