Socket
Socket
Sign inDemoInstall

@nerdwallet/jest-nock-fixtures

Package Overview
Dependencies
Maintainers
21
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nerdwallet/jest-nock-fixtures - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 1.1.0 (2020-10-09) brian123zx
- When nocks encounters a number of unmatched requests, the error function it calls now includes the path it expects to find the nock file at.
- Fixes a bug introduced in v1.0.2 where the first argument to `unmatchedErrorMessage` was the length of the unmatched request array instead of the array itself
## 1.0.2 (2020-10-07) brian123zx

@@ -2,0 +7,0 @@

2

package.json
{
"version": "1.0.2",
"version": "1.1.0",
"name": "@nerdwallet/jest-nock-fixtures",

@@ -4,0 +4,0 @@ "description": "jest-nock-fixtures",

@@ -34,6 +34,6 @@ # jest-nock-fixtures

createJestNockFixturesTestWrapper({
unmatchedErrorMessage: reqs =>
unmatchedErrorMessage: (reqs, { fixtureFilepath }) =>
`unmatched requests not allowed (found ${
reqs.length
}).\n\nRun \`npm run test:record\` to update fixtures, and try again.`
}).\n\nRun \`npm run test:record\` to update fixtures, and try again.`
});

@@ -40,0 +40,0 @@ ```

@@ -31,4 +31,6 @@ const { dirname, basename, join } = require('path');

},
unmatchedErrorMessage = unmatchedRequests =>
`unmatched requests not allowed (found ${unmatchedRequests}). Record fixtures and try again.`,
unmatchedErrorMessage = (unmatchedRequests, { fixtureFilepath }) =>
`unmatched requests not allowed (found ${
unmatchedRequests.length
}). Looking for fixtures at ${fixtureFilepath}. Record fixtures and try again.`,
} = options;

@@ -116,3 +118,3 @@

const unmatchedLength = unmatched.length;
const cachedUnmatched = unmatched;

@@ -126,10 +128,14 @@ // full cleanup

// report about unmatched requests
if (unmatchedLength) {
if (cachedUnmatched.length) {
if (isLockdownMode()) {
throw new Error(
`${logNamePrefix}: ${mode}: ${unmatchedErrorMessage(unmatchedLength)}`
`${logNamePrefix}: ${mode}: ${unmatchedErrorMessage(cachedUnmatched, {
fixtureFilepath: fixtureFilepath(),
})}`
);
} else if (isDryrunMode()) {
console.warn( // eslint-disable-line no-console,prettier/prettier
`${logNamePrefix}: ${mode}: ${unmatchedLength} unmatched requests`
`${logNamePrefix}: ${mode}: ${
cachedUnmatched.length
} unmatched requests`
);

@@ -136,0 +142,0 @@ }

@@ -58,6 +58,6 @@ const { dirname, basename, join } = require('path');

logNamePrefix = 'jest-nock-fixtures',
unmatchedErrorMessage = reqs =>
unmatchedErrorMessage = (reqs, { fixtureFilepath }) =>
`unmatched requests not allowed (found ${
reqs.length
}).\n\nRun with env variable \`JEST_NOCK_FIXTURES_MODE=record\` to update fixtures.`,
}). Looking for fixtures at ${fixtureFilepath}\n\nRun with env variable \`JEST_NOCK_FIXTURES_MODE=record\` to update fixtures.`,
beforeAll = global.beforeAll,

@@ -64,0 +64,0 @@ afterAll = global.afterAll,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc