Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 1e7fb5b

Browse files
committed
test(babili): fix failing babili test
1 parent c85ee35 commit 1e7fb5b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/babili.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import * as babili from './babili';
22
import * as configUtil from './util/config';
3+
import * as crossSpawn from 'cross-spawn';
4+
import { EventEmitter } from 'events';
35

46
describe('babili function', () => {
7+
const emitter = new EventEmitter();
58
beforeEach(() => {
69
spyOn(configUtil, 'getUserConfigFile').and.returnValue('fileContents');
10+
spyOn(crossSpawn, 'spawn').and.callFake(() => {
11+
return emitter;
12+
});
713
});
814

915
it('should call main babili function', () => {
@@ -12,7 +18,9 @@ describe('babili function', () => {
1218
};
1319
const configFile = 'configFileContents';
1420

15-
return babili.babili(context, configFile).then(() => {
21+
let pr = babili.babili(context, configFile);
22+
emitter.emit('close', 0);
23+
pr.then(() => {
1624
expect(configUtil.getUserConfigFile).toHaveBeenCalledWith(context, babili.taskInfo, configFile);
1725
});
1826
});

0 commit comments

Comments
 (0)