luoyjx / gaoqi-blog

A club based on Node.js and Mongodb with Promise(bluebird)
MIT License
57 stars 21 forks source link

An in-range update of nock is breaking the build 🚨 #100

Closed greenkeeper[bot] closed 4 years ago

greenkeeper[bot] commented 6 years ago

Version 9.3.0 of nock was just published.

Branch Build failing 🚨
Dependency nock
Current Version 9.2.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

nock is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details - ❌ **continuous-integration/travis-ci/push** The Travis CI build could not complete due to an error [Details](https://travis-ci.org/luoyjx/gaoqi-blog/builds/386757397?utm_source=github_status&utm_medium=notification) - βœ… **coverage/coveralls** First build on greenkeeper/nock-9.3.0 at 48.059% [Details](https://coveralls.io/builds/17275163)

Release Notes v9.3.0

9.3.0 (2018-05-30)

Features

Commits

The new version differs by 2 commits.

  • de0cb79 feat: support URL objects
  • 7582da0 chore(package): update tap to version 12.0.0

See the full diff

FAQ and help There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).

Your Greenkeeper Bot :palm_tree:

greenkeeper[bot] commented 6 years ago

After pinning to 9.2.6 your tests are passing again. Downgrade this dependency πŸ“Œ.

greenkeeper[bot] commented 6 years ago

Version 9.3.1 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.3.1

9.3.1 (2018-06-07)

Bug Fixes

Commits

The new version differs by 3 commits.

  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.3.2 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.3.2

9.3.2 (2018-06-07)

Bug Fixes

Commits

The new version differs by 4 commits.

  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.3.3 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.3.3

9.3.3 (2018-06-13)

Bug Fixes

  • match basePath as regex and path as function (#1147) (933880a)
Commits

The new version differs by 6 commits.

  • 933880a fix: match basePath as regex and path as function (#1147)
  • 1a03056 build(package): update restify-clients to version 2.2.0 (#1148)
  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.4.0 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.4.0

9.4.0 (2018-06-29)

Features

  • emit 'request' event with body as third parameter (#1062) (e15820a)
Commits

The new version differs by 10 commits.

  • e15820a feat: emit 'request' event with body as third parameter (#1062)
  • a1fff39 build(package): update eslint to version 5.0.0 (#1151)
  • da5de6a test: local ssl server (#1126)
  • e8479aa docs: change url to match new GitHub address
  • 933880a fix: match basePath as regex and path as function (#1147)
  • 1a03056 build(package): update restify-clients to version 2.2.0 (#1148)
  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.4.1 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.4.1

9.4.1 (2018-07-02)

Bug Fixes

  • request overrider checks req.headers to parse body as JSON (#1157) (f81fb6d)
Commits

The new version differs by 12 commits.

  • 5aa1081 docs: Add CONTRIBUTE, edit README, update LICENSE year (#1155)
  • f81fb6d fix: request overrider checks req.headers to parse body as JSON (#1157)
  • e15820a feat: emit 'request' event with body as third parameter (#1062)
  • a1fff39 build(package): update eslint to version 5.0.0 (#1151)
  • da5de6a test: local ssl server (#1126)
  • e8479aa docs: change url to match new GitHub address
  • 933880a fix: match basePath as regex and path as function (#1147)
  • 1a03056 build(package): update restify-clients to version 2.2.0 (#1148)
  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.4.2 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.4.2

9.4.2 (2018-07-10)

Bug Fixes

  • Replaced util._extend with Object.assign due to deprecated since node v6. (7fd2329)
Commits

The new version differs by 13 commits.

  • 7fd2329 fix: Replaced util._extend with Object.assign due to deprecated since node v6.
  • 5aa1081 docs: Add CONTRIBUTE, edit README, update LICENSE year (#1155)
  • f81fb6d fix: request overrider checks req.headers to parse body as JSON (#1157)
  • e15820a feat: emit 'request' event with body as third parameter (#1062)
  • a1fff39 build(package): update eslint to version 5.0.0 (#1151)
  • da5de6a test: local ssl server (#1126)
  • e8479aa docs: change url to match new GitHub address
  • 933880a fix: match basePath as regex and path as function (#1147)
  • 1a03056 build(package): update restify-clients to version 2.2.0 (#1148)
  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)
  • e933b3a refactor: update Buffer constructors to from and alloc (#1141)
  • d3f5b3f chore(package): update nyc to version 12.0.1

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.4.3 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.4.3

9.4.3 (2018-07-23)

Bug Fixes

  • #1171: When matching the path by function, also check the HTTP method. (9373382), closes #1171
Commits

The new version differs by 17 commits.

  • 9373382 fix(#1171): When matching the path by function, also check the HTTP method.
  • b1869cc test(#1171): Added test 'match path using function'
  • 29d1c2e docs(README.md): Change description to match package.json
  • ef7a68b docs(CODE_OF_CONDUCT.md): Change maintainer support email
  • 7fd2329 fix: Replaced util._extend with Object.assign due to deprecated since node v6.
  • 5aa1081 docs: Add CONTRIBUTE, edit README, update LICENSE year (#1155)
  • f81fb6d fix: request overrider checks req.headers to parse body as JSON (#1157)
  • e15820a feat: emit 'request' event with body as third parameter (#1062)
  • a1fff39 build(package): update eslint to version 5.0.0 (#1151)
  • da5de6a test: local ssl server (#1126)
  • e8479aa docs: change url to match new GitHub address
  • 933880a fix: match basePath as regex and path as function (#1147)
  • 1a03056 build(package): update restify-clients to version 2.2.0 (#1148)
  • b5b40c1 fix: restore compatibility with Node <4.5 (#1144)
  • aaa9a56 fix: use aborted property on http request (#1134)

There are 17 commits in total.

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.4.4 just got published.

Your tests are still failing with this version. Compare the changes 🚨

Release Notes v9.4.4

9.4.4 (2018-07-31)

Bug Fixes

Commits

The new version differs by 20 commits.

  • 907be86 fix(#1076): allowUnmocked: true + host regex (#1179)
  • 8f0912a docs: Add CHANGELOG file pointing to GitHub releases
  • 15a472f build(#1169): remove glob and istanbul
  • 9373382 fix(#1171): When matching the path by function, also check the HTTP method.
  • b1869cc test(#1171): Added test 'match path using function'
  • 29d1c2e docs(README.md): Change description to match package.json
  • ef7a68b docs(CODE_OF_CONDUCT.md): Change maintainer support email
  • 7fd2329 fix: Replaced util._extend with Object.assign due to deprecated since node v6.
  • 5aa1081 docs: Add CONTRIBUTE, edit README, update LICENSE year (#1155)
  • f81fb6d fix: request overrider checks req.headers to parse body as JSON (#1157)
  • e15820a feat: emit 'request' event with body as third parameter (#1062)
  • a1fff39 build(package): update eslint to version 5.0.0 (#1151)
  • da5de6a test: local ssl server (#1126)
  • e8479aa docs: change url to match new GitHub address
  • 933880a fix: match basePath as regex and path as function (#1147)

There are 20 commits in total.

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.5.0 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.5.0

9.5.0 (2018-08-07)

Features

  • encode an expected buffer the same way when matching as the client (c584f7a)
Commits

The new version differs by 3 commits.

  • 50ab208 test: new SSL certificates for local testing (#1181)
  • b29a0e4 docs: add buffer request body to README
  • c584f7a feat: encode an expected buffer the same way when matching as the client

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.6.0 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.6.0

9.6.0 (2018-08-08)

Features

  • Allow optionally() to be called with a value, specifying if the mock should be optional (d8a2606)
Commits

The new version differs by 5 commits.

  • d666949 Merge pull request #1177 from timrogers/master
  • d8a2606 feat: Allow optionally() to be called with a value, specifying if the mock should be optional
  • 50ab208 test: new SSL certificates for local testing (#1181)
  • b29a0e4 docs: add buffer request body to README
  • c584f7a feat: encode an expected buffer the same way when matching as the client

See the full diff

greenkeeper[bot] commented 6 years ago

Version 9.6.1 just got published.

Your tests are passing again with this version. Explicitly upgrade to this version πŸš€

Release Notes v9.6.1

9.6.1 (2018-08-13)

Bug Fixes

  • set socket connecting state to always be false (ca1eea0)
Commits

The new version differs by 9 commits.

  • 80da59c docs: Add a section on becoming a Maintainer
  • ca1eea0 fix: set socket connecting state to always be false
  • 463f82a Merge pull request #1186 from nock/greenkeeper/needle-2.2.2
  • a94e867 chore(package): update needle to version 2.2.2
  • d666949 Merge pull request #1177 from timrogers/master
  • d8a2606 feat: Allow optionally() to be called with a value, specifying if the mock should be optional
  • 50ab208 test: new SSL certificates for local testing (#1181)
  • b29a0e4 docs: add buffer request body to README
  • c584f7a feat: encode an expected buffer the same way when matching as the client

See the full diff

greenkeeper[bot] commented 6 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.0

BREAKING CHANGES

  • drop official support for Node < 6

There is no intentional change that breaks usage in Node 4, but as we
stop testing in this no longer supported Node version we recommend to
no update nock if you still rely on Node 4.

The reason why we decided to go ahead and make a breaking version
release is that it became increasingly harder to update dependencies
to the latest versions as they also drop support for Node 4.

Bug Fixes

Code Refactoring

  • update Buffer constructors to from and alloc (c94b89d)

Continuous Integration

  • travis: stop testing in Node 4 (139b632)
Commits

The new version differs by 42 commits.

  • a7cdc71 test: skip failing test (#1222)
  • c94b89d refactor: update Buffer constructors to from and alloc
  • 59060d5 test: update Buffer constructors to from and alloc
  • 85f847a ci(travis): test in Node 10 instead of 9
  • 139b632 ci(travis): stop testing in Node 4
  • cc3a539 docs: update tocs
  • 1aefc98 Update package.json
  • 7a8e564 Update README.md
  • 31ea668 Added call to donate after npm install (optional)
  • 11f8d1f Added backers and sponsors on the README
  • d2a76fa Merge pull request #1218 from nock/lock
  • c1c229b Merge pull request #1217 from nock/stale
  • 87e252e ci(lock): initial configuration
  • cf50c23 ci(stale): initial configuration
  • 21c255f fix(#1203): handle statusCode without payload

There are 42 commits in total.

See the full diff

greenkeeper[bot] commented 6 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v10.0.1

10.0.1 (2018-10-09)

Bug Fixes

  • package: update debug to version 4.1.0 (0c807c9), closes #1214
Commits

The new version differs by 54 commits.

  • 3131313 Merge pull request #1238 from nock/greenkeeper/debug-4.1.0
  • 0c807c9 fix(package): update debug to version 4.1.0
  • 539d244 test: add comments to all tests that use airplane setting (#1237)
  • e226c65 docs: clean up debugging section
  • 7e70d9a docs: Delete sections duplicated in CONTRIBUTING
  • 43cf093 docs: move PROTIP elsewhere
  • 7498574 docs: remove empty spaces
  • 6b632d5 Merge pull request #1225 from nock/node-version-support
  • 8592632 ci(stale): set number of actions to 30 (default)
  • cbd2670 docs(README): Node version support
  • e6d885f ci(travis): coverage upload
  • f12cda7 ci(package): coverage
  • a7cdc71 test: skip failing test (#1222)
  • c94b89d refactor: update Buffer constructors to from and alloc
  • 59060d5 test: update Buffer constructors to from and alloc

There are 54 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.2

10.0.2 (2018-11-03)

Bug Fixes

Commits

The new version differs by 18 commits.

  • 598245c Merge pull request #1250 from vwxyutarooo/master
  • 8453191 test: add case of nockBack with filteringRequestBody opiton
  • 1b4b9c6 test: add case of nockBack with filteringPath option
  • 6d5bca2 fix(#1041): apply filteringPath from nockBack before option
  • 048c07d Merge pull request #1247 from j0k3r/patch-1
  • 5b69d06 docs: Fix anchor in README
  • 35936eb Merge pull request #1246 from chrisulanowicz/master
  • e63de1a docs: fixed typos
  • 7f41138 Merge pull request #1220 from nock/feat/github-apps-note
  • 33da255 Merge pull request #1163 from nock/feat/add-contributors
  • 1a845a5 docs: Update list and instructions
  • c1f608a docs: Add note about GitHub Apps
  • 2c9f427 docs: Add description to Contributors file
  • f907c3f docs: rename CONTRIBUTORS.md, add section to CONTRIBUTING
  • 0885b5f docs: remove contribs file

There are 18 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.3

10.0.3 (2018-12-03)

Bug Fixes

Commits

The new version differs by 22 commits.

  • 5ae978b docs: show usage of beforeFunc in nockback (#1263)
  • 88fbdc2 fix: filtering by regex (#1089)
  • 6cd119b chore(package): update superagent to version 4.0.0
  • 4194106 docs(README): recorder.reset -> recorder.clear (#1248)
  • 598245c Merge pull request #1250 from vwxyutarooo/master
  • 8453191 test: add case of nockBack with filteringRequestBody opiton
  • 1b4b9c6 test: add case of nockBack with filteringPath option
  • 6d5bca2 fix(#1041): apply filteringPath from nockBack before option
  • 048c07d Merge pull request #1247 from j0k3r/patch-1
  • 5b69d06 docs: Fix anchor in README
  • 35936eb Merge pull request #1246 from chrisulanowicz/master
  • e63de1a docs: fixed typos
  • 7f41138 Merge pull request #1220 from nock/feat/github-apps-note
  • 33da255 Merge pull request #1163 from nock/feat/add-contributors
  • 1a845a5 docs: Update list and instructions

There are 22 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.4

10.0.4 (2018-12-08)

Bug Fixes

Commits

The new version differs by 24 commits.

  • a90f543 fix(#1266): throw useful error if "method" parameter is not set for .intercept() – thanks @labsvisual
  • aaf82bb chore: ignore package-lock.json
  • 5ae978b docs: show usage of beforeFunc in nockback (#1263)
  • 88fbdc2 fix: filtering by regex (#1089)
  • 6cd119b chore(package): update superagent to version 4.0.0
  • 4194106 docs(README): recorder.reset -> recorder.clear (#1248)
  • 598245c Merge pull request #1250 from vwxyutarooo/master
  • 8453191 test: add case of nockBack with filteringRequestBody opiton
  • 1b4b9c6 test: add case of nockBack with filteringPath option
  • 6d5bca2 fix(#1041): apply filteringPath from nockBack before option
  • 048c07d Merge pull request #1247 from j0k3r/patch-1
  • 5b69d06 docs: Fix anchor in README
  • 35936eb Merge pull request #1246 from chrisulanowicz/master
  • e63de1a docs: fixed typos
  • 7f41138 Merge pull request #1220 from nock/feat/github-apps-note

There are 24 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.5

10.0.5 (2018-12-23)

Bug Fixes

  • package.engines shows incorrect versions and is supposed to be an object (0c4edd6)
Commits

The new version differs by 57 commits.

  • 0c4edd6 fix: package.engines shows incorrect versions and is supposed to be an object
  • 743102a ci(package): update semantic-release to beta.13
  • c5945a7 ci(travis): run release stage on [Version].x, next, beta branches
  • e0424c0 docs(CONTRIBUTING): Backport a fix / feature to a previous version
  • bb602cc ci(travis): build on branches for semantic-release preview/next/maintenance releases
  • e5ee2b5 build(package): update semantic-release to ^16.0.0-beta.10
  • 46c1156 test(test_back): Improve style and readability
  • 16fb5bd build(package): explicitly pipe lcov output to coveralls
  • dcc9599 ci: remove obsolete coveralls configuration
  • b39172f test(test_s3): Add fixme comment
  • 5c67b46 test(test_aws_dynamo): Remove AWS Dynamo functional test
  • c010b09 test(test_abort): Improve style + readability
  • 14816f9 test: Replace lodash with native in tests
  • ab3c181 chore: Ignore β€˜tests/ssl/index.js’ for coverage
  • cefeb47 Clean lint

There are 57 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are passing again with this update. Explicitly upgrade to this version πŸš€

Release Notes for v10.0.6

10.0.6 (2019-01-02)

Bug Fixes

Commits

The new version differs by 58 commits.

  • cb56669 fix: Mock responses should fire when timers are mocked (#1335)
  • 0c4edd6 fix: package.engines shows incorrect versions and is supposed to be an object
  • 743102a ci(package): update semantic-release to beta.13
  • c5945a7 ci(travis): run release stage on [Version].x, next, beta branches
  • e0424c0 docs(CONTRIBUTING): Backport a fix / feature to a previous version
  • bb602cc ci(travis): build on branches for semantic-release preview/next/maintenance releases
  • e5ee2b5 build(package): update semantic-release to ^16.0.0-beta.10
  • 46c1156 test(test_back): Improve style and readability
  • 16fb5bd build(package): explicitly pipe lcov output to coveralls
  • dcc9599 ci: remove obsolete coveralls configuration
  • b39172f test(test_s3): Add fixme comment
  • 5c67b46 test(test_aws_dynamo): Remove AWS Dynamo functional test
  • c010b09 test(test_abort): Improve style + readability
  • 14816f9 test: Replace lodash with native in tests
  • ab3c181 chore: Ignore β€˜tests/ssl/index.js’ for coverage

There are 58 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Commits

The new version differs by 295 commits.

  • 2e56fb0 feat(types): Add Typescript definitions. (#1676)
  • 688b3e3 refactor: Fix two tests that don’t work on an airplane (#1679)
  • 82a3cae chore(dep): remove unneeded dev dep acron (#1668)
  • c09afda refactor: Refactor RequestOverrider (#1674)
  • 4d0fbbf refactor: Convert Interceptor to a class (#1672)
  • 26784ac chore(package): update rimraf to version 3.0.0 (#1667)
  • 870584b bug(overrider): unmocked HTTPS request with partial interceptor match (#1664)
  • 11dba99 fix (#1659)
  • bf1d7d6 test: Clarify that cleanAll removes persistent mocks (#1647)
  • e661d0d bug(recorder): replace qs lib with native querystring. (#1653)
  • 05ae31e Refactor lifecycle tests using got / async (#1646)
  • 26fc08f Async Reply functions (always emit errors) (#1596)
  • 35221ce refactor: overhaul body and query matching (#1632)
  • 88e85ac fix: trigger release (#1645)
  • e744b0a bug: handle content-type request headers when arrays

There are 250 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11

Upgrading from Nock 10 to Nock 11

Bug fixes and internal improvements

Nock 11 includes many under-the-hood improvements, including a fully offline
test suite and 100% test coverage. The codebase was also converted to ES6
syntax and formatted with Prettier. Leaning on the test coverage, some
substantial refactors have begun.

Many bug fixes are included. See the detailed changelog below or the
compare view for details.

Fabulous new features for developers

  1. The library ships with TypeScript definitions. (Added in v11.3)
  2. Add support for the http.request signatures added in Node 10.9
  3. Scopes can be filtered using the system environment or any external factor
    using e.g. .conditionally(() => true)
  4. In-flight modifications to headers are preserved in mock requests.
  5. Recorded mocks can be stringified using custom code in the afterRecord()
    post-processing hook. When afterRecord() returns a string, the
    recorder will no longer attempt to re-stringify it. (Added in v11.3)
  6. Reply functions passed to .reply() can now be async/promise-returning.
  7. Specifying reply headers, either via .reply() or .defaultReplyHeaders(),
    can now be done consistently using an object, Map, or flat array.

Breaking changes

For many developers no code changes will be needed. However, there are several
minor changes to the API, and it's possible that you will need to update your
code for Nock to keep working properly. It's unlikely that your tests will
falsely pass; what's more probable is that your tests will fail until the
necessary changes are made.

  1. Nock 11 requires Node 8 or later. Nock supports and tests all the "current"
    and "maintenance" versions of Node. As of now, that's Node 8, 10, and 12.

  2. In Nock 10, when reply() was invoked with a function, the return values were
    handled ambiguously depending on their types.

    Consider the following example:

    const scope = nock('http://example.com')
      .get('/')
      .reply(200, () => [500, 'hello world'])

    In Nock 10, the 200 was ignored, the 500 was interpreted as the status
    code, and the body would contain 'hello world'. This caused problems
    when the goal was to return a numeric array, so in Nock 11, the 200 is
    properly interpreted as the status code, and [500, 'hello world'] as the
    body.

    These are the correct calls for Nock 11:

    const scope = nock('http://example.com')
      .get('/')
      .reply(500, 'hello world')
    
    const scope = nock('http://example.com')
      .get('/')
      .reply(500, () => 'hello world')

    The .reply() method can be called with explicit arguments:

    .reply() // `statusCode` defaults to `200`.
    .reply(statusCode) // `responseBody` defaults to `''`.
    .reply(statusCode, responseBody) // `headers` defaults to `{}`.
    .reply(statusCode, responseBody, headers)

    It can be called with a status code and a function that returns an array:

    .reply(statusCode, (path, requestBody) => responseBody)
    .reply(statusCode, (path, requestBody) => responseBody, headers)

    Alternatively the status code can be included in the array:

    .reply((path, requestBody) => [statusCode])
    .reply((path, requestBody) => [statusCode, responseBody])
    .reply((path, requestBody) => [statusCode, responseBody, headers])
    .reply((path, requestBody) => [statusCode, responseBody], headers)

    .reply() can also be called with an async or promise-returning function. The
    signatures are identical, e.g.

    .reply(async (path, requestBody) => [statusCode, responseBody])
    .reply(statusCode, async (path, requestBody) => responseBody)

    Finally, an error-first callback can be used, e.g.:

    .reply((path, requestBody, cb) => cb(undefined, [statusCode, responseBody]))
    .reply(statusCode, (path, requestBody, cb) => cb(undefined, responseBody))
  3. In Nock 10, errors in user-provided reply functions were caught by Nock, and
    generated HTTP rersponses with status codes of 500. In Nock 11 these errors
    are not caught, and instead are re-emitted through the request, like any
    other error that occurs during request processing.

    Consider the following example:

    const scope = nock('http://example.com')
      .post('/echo')
      .reply(201, (uri, requestBody, cb) => {
        fs.readFile('cat-poems.txt', cb) // Error-first callback
      })

    When fs.readFile() errors in Nock 10, a 500 error was emitted. To get the
    same effect in Nock 11, the example would need to be rewritten to:

    const scope = nock('http://example.com')
      .post('/echo')
      .reply((uri, requestBody, cb) => {
        fs.readFile('cat-poems.txt', (err, contents) => {
          if (err) {
            cb([500, err.stack])
          } else {
            cb([201, contents])
          }
        })
      })
  4. When .reply() is invoked with something other than a whole number status
    code or a function, Nock 11 raises a new error Invalid ... value for status code.

  5. Callback functions provided to the .query method now receive the result of
    querystring.parse
    instead of qs.parse.

    In particular, querystring.parse does not interpret keys with JSON
    path notation:

    querystring.parse('foo[bar]=baz') // { "foo[bar]": 'baz' }
    qs.parse('foo[bar]=baz') // { foo: { bar: 'baz' } }
  6. In Nock 10, duplicate field names provided to the .query() method were
    silently ignored. We decided this was probably hiding unintentionally bugs
    and causing frustration with users. In Nock 11, attempts to provide query
    params more than once will throw a new error
    Query parameters have aleady been defined. This could happen by calling
    .query() twice, or by calling .query() after specifying a literal query
    string via the path.

    nock('http://example.com')
      .get('/path')
      .query({ foo: 'bar' })
      .query({ baz: 'qux' }) // <-- will throw
      .reply()
    
    nock('http://example.com')
      .get('/path?foo=bar')
      .query({ baz: 'qux' }) // <-- will throw
      .reply()
  7. Paths in Nock have always required a leading slash. e.g.

    const scope = nock('http://example.com')
      .get('/path')
      .reply()

    In Nock 10, if the leading slash was missing the mock would never match. In
    Nock 11, this raises an error.

  8. The reqheaders parameter should be provided as a plain object, e.g.
    nock('http://example.com', { reqheaders: { X-Foo: 'bar' }}). When the
    headers are specified incorrectly as e.g. { reqheaders: 1 }, Nock 10 would
    behave in unpredictable ways. In Nock 11, a new error
    Headers must be provided as an object is thrown.

    nock('http://example.com', { reqheaders: 1 })
      .get('/')
      .reply()
  9. In Nock 10, the ClientRequest instance wrapped the native on method
    and aliased once to it. In Nock 11, this been removed and request.once
    will correctly call registered listeners...once.

  10. In Nock 10, when the method was not specified in a call to nock.define(),
    the method would default GET. In Nock 11, this raises an error.

  11. In very old versions of nock, recordings may include a response status
    code encoded as a string in the reply field. In Nock 10 these strings could
    be non-numeric. In Nock 11 this raises an error.

Updates to the mock surface

  1. For parity with a real response, a mock request correctly supports all
    the overrides to request.end(), including request.end(cb) in Node 12.
  2. For parity with a real response, errors from the .destroy() method
    are propagated correctly. (Added in v11.3)
  3. For parity with a real response, the .complete property is set when
    ending the response.
  4. For parity with a real Socket, the mock Socket has an unref() function
    (which does nothing).

If you discover bugs in this release, please open a bug report on the Nock repo. πŸ›


Detailed changelog

BREAKING CHANGES

  • uncaught errors thrown inside of user provided reply functions, whether async or not, will no longer be caught, and will no longer generate a successful response with a status code of 500. Instead, the error will be emitted by the request just like any other unhandled error during the request processing.
  • The only argument passed to the Interceptor.query callback now receives the output from querystring.parse instead of qs.parse. This means that instead of nested objects the argument will be a flat object.
  • interceptor: Attempting to call Interceptor.query twice throws an error.
  • interceptor: Providing a duplicate search parameter to the query
    method throws an error instead of ignoring subsequent values.
  • Drop support for Node 6

Features

Bug Fixes

Code Refactoring

Commits

The new version differs by 10 commits.

  • 65a8a6a fix(types): use export = and declares (#1695)
  • d86245f refactor: Refactor net connect tests (#1688)
  • ad000ef docs: Add "Common issues" section documenting got automatic retrying (#1687)
  • 8e78ffe style: Minor style improvements (#1693)
  • 949d264 test: Add todo test for conflict between hostnames (#1109)
  • 057bbdf fix: add extension to main field in package.json (#1683)
  • 89eb03a refactor: replace some lodash usage with native (#1685)
  • 6ca2bd3 Update eslint-config-standard to the latest version πŸš€ (#1681)
  • e0930f8 feat: afterRecord support for custom formatting after recording. (#1682)
  • de9c40b feat(socket): propagate errors from destroy method (#1675)

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.3.3

11.3.3 (2019-09-05)

Bug Fixes

Commits

The new version differs by 256 commits ahead by 256, behind by 251.

  • a700fa2 fix(types): DataMatcher to allow valid JSON scalars. (#1703)
  • 9d5cda0 docs(README): adapt badges for @latest release
  • cfc129c chore(deps): bump eslint-utils from 1.4.0 to 1.4.2 (#1698)
  • 21733b4 refactor: Remove the last of the real hostnames (#1691)
  • f00f0f3 test: Replace test_s3 with test of Expect: 100-continue (#1690)
  • b83e720 fix(types): use export = and declares (#1695)
  • 66799f3 refactor: Refactor net connect tests (#1688)
  • dafa35b docs: Add "Common issues" section documenting got automatic retrying (#1687)
  • 11a9517 style: Minor style improvements (#1693)
  • 50c821b test: Add todo test for conflict between hostnames (#1109)
  • a334e92 fix: add extension to main field in package.json (#1683)
  • c0372a2 refactor: replace some lodash usage with native (#1685)
  • 8bc6ea8 Update eslint-config-standard to the latest version πŸš€ (#1681)
  • da840fe feat: afterRecord support for custom formatting after recording. (#1682)
  • 41be884 feat(socket): propagate errors from destroy method (#1675)

There are 250 commits in total.

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.3.4

11.3.4 (2019-09-12)

Bug Fixes

Commits

The new version differs by 6 commits.

  • fa0a08a fix: Fix crash when matching certain objects (#1714)
  • d7b2c92 refactor: Separate concerns of interceptor brokering and playback (+ other minor refactors) (#1677)
  • edce256 refactor: Refactor exports to reduce indirection (#1673)
  • c107817 refactor: Refactor recorder stringification (#1678)
  • 588cd1f docs(README): Add axios example (#1711)
  • 805df19 Update eslint-plugin-node to the latest version πŸš€ (#1705)

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.3.5

11.3.5 (2019-09-20)

Bug Fixes

Commits

The new version differs by 7 commits.

  • 59b345c fix(types): data matcher for body and query. (#1725)
  • 6b88dff Add TypeScript version to bug template (#1709)
  • ed47e59 refactor: Inline setHeader() function (#1722)
  • e35b370 refactor: Rename request_overrider -> intercepted_request_router (#1716)
  • f6e319d refactor: Avoid unnecessary call to setRequestHeaders after matching (#1719)
  • 96a6862 refactor: Remove unnecessary getHeader() function (#1717)
  • 7dca510 refactor: Split playbackInterceptor into its own module (#1712)

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.3.6

11.3.6 (2019-10-05)

Bug Fixes

Commits

The new version differs by 2 commits.

  • 3f18d70 fix: Fix error message (#1736)
  • 2d15d05 docs(README): Replace --save option with --save-dev (#1734)

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.4.0

11.4.0 (2019-10-07)

Features

  • improve error output by showing which URL caused the error (#1735) (#1740) (f4a208b)
Commits

The new version differs by 2 commits.

  • f4a208b feat: improve error output by showing which URL caused the error (#1735) (#1740)
  • b71bfd0 Update lolex to the latest version πŸš€ (#1739)

See the full diff

greenkeeper[bot] commented 5 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.5.0

11.5.0 (2019-10-22)

Features

  • Throw errors for URL paths without leading slashes, which will never match (#1744) (b7f9f13), closes #1730
Commits

The new version differs by 6 commits.

  • b7f9f13 feat: Throw errors for URL paths without leading slashes, which will never match (#1744)
  • 7a568dd refactor: Rewrite a gnarly nested loop (#1755)
  • be011ea refactor(test_allow_unmocked_https): Avoid a hardcoded port (#1751)
  • 2d611db refactor(test_allow_unmocked_https): Replace Object.assign with spread (#1750)
  • 69976a7 chore: limit published files (#1745)
  • d687179 refactor(router): pass socket to response constructor. (#1743)

See the full diff

greenkeeper[bot] commented 4 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.6.0

11.6.0 (2019-10-24)

Features

Commits

The new version differs by 1 commits.

  • 187db85 feat: Add lifecycle function to clear pending timeouts (#1748)

See the full diff

greenkeeper[bot] commented 4 years ago

Your tests are still failing with this version. Compare changes

Release Notes for v11.7.0

11.7.0 (2019-10-31)

Features

Commits

The new version differs by 29 commits.

  • ba60fd2 feat(types): add type for Nock Back currentMode (#1794)
  • e1597ad refactor: Modernize NOCK_OFF test and make SSL helper async (#1799)
  • 23145c1 ci: Lint only once (#1793)
  • a06279e test: Get all tests passing in Mocha too, and run in CI (#1787)
  • 6316d74 refactor: Mocha DSL for test_persist_optionally (#1797)
  • 3f74df0 refactor: Mocha DSL for recorder tests, first pass (#1789)
  • ebfe612 refactor: Mocha DSL for test_query (#1791)
  • f9cbcd9 refactor: chai assertions in test_persist_optionally (#1790)
  • cc6f74c refactor: Rewrite test_query using got, async, and chai (#1788)
  • 6aa42aa refactor: Rewrite test with mock timer using got/async (#1785)
  • dc2cc2c refactor: Better document a couple tests / titles (#1786)
  • ca29b6a refactor: Rewrite superagent recorder tests using got (#1782)
  • 0c5c806 refactor: Mocha DSL for test_redirects, test_remove_interceptor, test_repeating (#1784)
  • 4f70825 Remove restify tests (#1779)
  • 1a60bd0 Rewrite hyperquest integration test (#1778)

There are 29 commits in total.

See the full diff