Skip to content

Why nock throw error Nock: No match for request when repeating request  #2140

@taozi0818

Description

@taozi0818

Tests case:

nock('https://xxxx.com').get('/').times(1).reply(200, { mock: 1 });

// first times: print { mock: 1 }
// second and third times: throw error `Nock: No match for request`
for (let i = 0; i < 3; i++) {
  const {data} = await axios({
    url: 'https://xxxx.com/',
    method: 'GET',
  });
  console.log(data);
}

In README, means you can get real response from url you specified but not an error.

But in your tests cases:
It should get error when repeating.

Version

  • Nodejs: v12
  • Nock: 13.0.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions