mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Do not clobber process properties with test mocks (#783)
This commit is contained in:
parent
47c6048d53
commit
997943a194
@ -201,14 +201,7 @@ describe('run', () => {
|
|||||||
describe('help', () => {
|
describe('help', () => {
|
||||||
it('should print out usage and help', () => {
|
it('should print out usage and help', () => {
|
||||||
spyOn(console, 'log');
|
spyOn(console, 'log');
|
||||||
|
spyOn(process, 'exit');
|
||||||
// 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();
|
run.help();
|
||||||
expect(console.log).toHaveBeenCalledWith(jasmine.stringMatching(/^Usage:/));
|
expect(console.log).toHaveBeenCalledWith(jasmine.stringMatching(/^Usage:/));
|
||||||
|
Loading…
Reference in New Issue
Block a user