Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.23 KB

migrating_to_12.md

File metadata and controls

33 lines (24 loc) · 1.23 KB

Upgrading from Nock 11 to Nock 12

Release Tag

Breaking changes

  1. Support for Node < 10 was dropped.
    To upgrade Nock, ensure your version of Node is also updated.
    At the time of release, Node 10.x, 12.x, and 13.x were supported.

  2. cleanAll() no longer returns the global nock instance (#1872).

    // before
    nock.cleanAll().restore() // Uncaught TypeError: Cannot read property 'restore' of undefined
    
    // upgraded
    nock.cleanAll()
    nock.restore()
  3. Support was dropped for the String constructor (#1873).
    Only string primitive are supported. All strings passed to Nock for options should not use new String syntax. MDN web docs.

New features for developers

  1. enableNetConnect() now accepts a function.
    nock.enableNetConnect(
      host => host.includes('amazon.com') || host.includes('github.com'),
    )