test: call "expect()" on a correct call stack (#23675)

This commit is contained in:
Alexey Kuzmin 2020-05-20 22:18:48 +02:00 committed by GitHub
parent 9d851b8791
commit 33d6a99d40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 49 deletions

View file

@ -44,7 +44,7 @@ describe('ipc module', () => {
it('receives a response from an asynchronous handler', async () => {
ipcMain.handleOnce('test', async (e: IpcMainInvokeEvent, arg: number) => {
expect(arg).to.equal(123);
await new Promise(resolve => setImmediate(resolve));
await new Promise(setImmediate);
return 3;
});
const done = new Promise(resolve => ipcMain.once('result', (e, arg) => {
@ -69,7 +69,7 @@ describe('ipc module', () => {
it('receives an error from an asynchronous handler', async () => {
ipcMain.handleOnce('test', async () => {
await new Promise(resolve => setImmediate(resolve));
await new Promise(setImmediate);
throw new Error('some error');
});
const done = new Promise(resolve => ipcMain.once('result', (e, arg) => {