Skip to content

Commit

Permalink
fix: unstable test
Browse files Browse the repository at this point in the history
  • Loading branch information
liximomo committed Jul 26, 2022
1 parent 2bbc9ad commit 3f729ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/e2e/custom-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ describe('custom/app.js', () => {

it('should get correct log', async () => {
const logSpy = jest.spyOn(console, 'log');
let logs = '';
logSpy.mockImplementation((...args) => {
logs += args.filter(a => typeof a === 'string').join('');
});

page = await ctx.browser.page(ctx.url('/'));
expect(logs).toMatch('init\ndispose\n');

expect(logSpy).toHaveBeenNthCalledWith(1, 'init\n');
expect(logSpy).toHaveBeenNthCalledWith(2, 'dispose\n');
logSpy.mockRestore();
});
});

0 comments on commit 3f729ef

Please sign in to comment.