Skip to content

Commit

Permalink
end() reject instead of throw
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal committed Mar 25, 2019
1 parent ae3f617 commit 00011e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/jest-worker/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ it('does not let end the farm after it is ended', () => {

farm.end();
expect(farm._workerPool.end).toHaveBeenCalledTimes(1);
expect(() => farm.end()).toThrow(
expect(farm.end()).rejects.toThrow(
'Farm is ended, no more calls can be done to it',
);
expect(() => farm.end()).toThrow(
expect(farm.end()).rejects.toThrow(
'Farm is ended, no more calls can be done to it',
);
expect(farm._workerPool.end).toHaveBeenCalledTimes(1);
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export default class JestWorker {
return this._workerPool.getStdout();
}

end(): Promise<PoolExitResult> {
async end(): Promise<PoolExitResult> {
if (this._ending) {
throw new Error('Farm is ended, no more calls can be done to it');
}
this._ending = true;

return this._workerPool.end();
return await this._workerPool.end();
}
}

0 comments on commit 00011e2

Please sign in to comment.