Skip to content

Polly: Cannot read property 'setRequestInterception' of null #1767

@hubidu

Description

@hubidu

What are you trying to achieve?

I am using I.mockRequest('GET', '/api/users', 200); in my test.

What do you get instead?

Cannot read property 'setRequestInterception' of null
  ypeError: Cannot read property 'setRequestInterception' of null
      at Polly._disconnectPuppeteer (node_modules\codeceptjs\lib\helper\Polly.js:164:16)
      at Polly.stopMocking (node_modules\codeceptjs\lib\helper\Polly.js:156:16)
      at Polly._after (node_modules\codeceptjs\lib\helper\Polly.js:56:16)

The call itself works, but I get the above error in the after hook, when _stopMocking() is called.

I think the cause is that the Puppeteer page has already been closed in the after hook and is no longer available (provided restart is set to true).

Details

  • CodeceptJS version: 2.2.0
  • NodeJS Version: 10.x
  • Operating System: Windows
  • Polly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions