
Security News
Inside Lodash’s Security Reset and Maintenance Reboot
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.
@tapjs/nock
Advanced tools
@tapjs/nockA tap extension that integrates nock.
t.nock()
nock.disableNetConnect()nock, and the result from
nock returnednock.enableNetConnect() in teardownt.nock.snapshot()
nock scopes for youLoad the @tapjs/nock plugin in your tap config.
For example, in .taprc:
plugins:
- @tapjs/nock
Or in package.json:
{
"tap": {
"plugins": ["@tapjs/nock"]
}
}
Then use it in your tests like so:
import t from 'tap'
t.test('sends a request', async t => {
t.nock('https://registry.npmjs.org')
.get('/')
.reply(200, { hello: 'world' })
const res = await fetch('https://registry.npmjs.org')
t.equal(res.status, 200)
const body = await res.json()
t.same(body, { hello: 'world' })
})
// when snapshots are enabled, this test will send a real request
// and record the response
// when they are disabled, the recorded response will be
// automatically loaded into a nock scope, and the test will
// receive that response
// This requires that the @tapjs/snapshot plugin is enabled.
t.test('snapshots a request', async t => {
t.nock.snapshot()
const res = await fetch('https://registry.npmjs.org')
t.equal(res.status, 200)
const body = await res.json()
t.match(body, { db_name: 'registry' })
})
You may use it directly, though that is a bit more clunky,
because it won't be automatically applied to child tests, but it
can be good if you only need nock in a small number of tests.
import { plugin as tapNock } from '@tapjs/nock'
import t from 'tap'
t.test('sends a request', async t => {
const tn = tapNock(t)
tn.nock('https://registry.npmjs.org')
.get('/')
.reply(200, { hello: 'world' })
const res = await fetch('https://registry.npmjs.org')
t.equal(res.status, 200)
const body = await res.json()
t.same(body, { hello: 'world' })
})
// when snapshots are enabled, this test will send a real request
// and record the response
// when they are disabled, the recorded response will be
// automatically loaded into a nock scope, and the test will
// receive that response
// This requires that the @tapjs/snapshot plugin is enabled.
t.test('snapshots a request', async t => {
const tn = tapNock(t)
tn.nock.snapshot()
const res = await fetch('https://registry.npmjs.org')
t.equal(res.status, 200)
const body = await res.json()
t.match(body, { db_name: 'registry' })
})
This plugin was originally developed by nlf as the standalone extension @npmcli/tap-nock, and the use case was a major inspiration for tap's plugin eventual architecture.
FAQs
a nock extension for tap
The npm package @tapjs/nock receives a total of 62 weekly downloads. As such, @tapjs/nock popularity was classified as not popular.
We found that @tapjs/nock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.

Security News
n8n led JavaScript Rising Stars 2025 by a wide margin, with workflow platforms seeing the largest growth across categories.

Security News
The U.S. government is rolling back software supply chain mandates, shifting from mandatory SBOMs and attestations to a risk-based approach.