Skip to content

Commit

Permalink
ci: fix failing build on Puppeteer 10.2+ (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszfiszer committed Nov 4, 2021
1 parent 0ead16d commit 8a5f916
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/node.js.yml
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: Run tests
env:
TEST_LIBRARY: ${{matrix.library}}
TEST_LIBRARY_VERSION: ${{matrix.version}}
run: npm test

release:
Expand Down
10 changes: 9 additions & 1 deletion test/integration/mockiavelli.int.test.ts
Expand Up @@ -8,8 +8,9 @@ const METHODS: HttpMethod[] = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
type Methods = 'mockGET' | 'mockPUT' | 'mockPOST' | 'mockDELETE' | 'mockPATCH';

const TEST_LIBRARY = process.env.TEST_LIBRARY || 'puppeteer';
const TEST_LIBRARY_VERSION = process.env.TEST_LIBRARY_VERSION || '1.10';

describe(`Mockiavelli integration [${TEST_LIBRARY}]`, () => {
describe(`Mockiavelli integration [${TEST_LIBRARY}@${TEST_LIBRARY_VERSION}]`, () => {
const ctx = setupTestCtx(TEST_LIBRARY);

test.each(METHODS)('matches request with .mock method ', async (METHOD) => {
Expand Down Expand Up @@ -708,6 +709,13 @@ describe(`Mockiavelli integration [${TEST_LIBRARY}]`, () => {
});

test('disable() method disables mocking of requests', async () => {
// Puppeteer.Page.off is broken in puppeteer 10.2+.
// Disable test until fix is released
// https://github.com/puppeteer/puppeteer/pull/7624
if (TEST_LIBRARY === 'puppeteer' && TEST_LIBRARY_VERSION === '10') {
return;
}

const mockedFun = jest.fn().mockReturnValue({ status: 200 });
await ctx.mockiavelli.mockGET('/example', mockedFun);

Expand Down

0 comments on commit 8a5f916

Please sign in to comment.