{"id":21010595,"url":"https://github.com/geoffdutton/nock-dvr","last_synced_at":"2025-12-29T23:45:10.987Z","repository":{"id":35072472,"uuid":"203263752","full_name":"geoffdutton/nock-dvr","owner":"geoffdutton","description":"A modern network request recording for testing complex Web APIs.","archived":false,"fork":false,"pushed_at":"2023-01-11T11:01:04.000Z","size":758,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T00:37:40.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geoffdutton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-19T23:18:02.000Z","updated_at":"2021-05-10T19:21:13.000Z","dependencies_parsed_at":"2023-01-15T13:14:34.016Z","dependency_job_id":null,"html_url":"https://github.com/geoffdutton/nock-dvr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoffdutton%2Fnock-dvr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoffdutton%2Fnock-dvr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoffdutton%2Fnock-dvr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoffdutton%2Fnock-dvr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geoffdutton","download_url":"https://codeload.github.com/geoffdutton/nock-dvr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243437538,"owners_count":20290857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T09:21:36.678Z","updated_at":"2025-12-29T23:45:10.922Z","avatar_url":"https://github.com/geoffdutton.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nock DVR Recorder\n[![npm](https://img.shields.io/npm/v/nock-dvr)](https://www.npmjs.com/package/nock-dvr)\n[![codecov](https://codecov.io/gh/geoffdutton/nock-dvr/branch/master/graph/badge.svg)](https://codecov.io/gh/geoffdutton/nock-dvr)\n[![Greenkeeper badge](https://badges.greenkeeper.io/geoffdutton/nock-dvr.svg)](https://greenkeeper.io/)\n\n## About\n\nAn updated, modern network recorder with the goal of being test framework agnostic. Inspired by:\n- [nock-vcr-recorder-mocha](https://github.com/poetic-labs/nock-vcr-recorder-mocha)\n- [nock-vcr-recorder](https://github.com/poetic/nock-vcr-recorder) - A wrapper around to simplify\ncreating vcr cassettes in mocha.\n\n## Install\n\n```bash\nnpm install --save-dev nock-dvr\n```\n\n## Usage\n\n- [x] Works with Mocha\n- [ ] Works with Jest\n\nWhen you need to record cassettes you can either:\n\n- Use `dvr.describe` instead of `describe`\n- Use `dvr.it` instead of `it`\n\n`dvr.describe` will record an episode before each test in that block. So\nyou can have multiple `it`s and it will record any requests within them.\n\n`dvr.it` will record a cassette for one specific test.\n\nThey both support `.skip` and `.only` as mocha does.\n\n```js\nconst request = require('request');\nconst assert = require('assert');\nconst dvr = require('nock-dvr');\n\ndescribe('normal test', function() {\n  dvr.it.only('works', function(done) {\n    request('http://localhost:4000/users', function(err, res, body) {\n      assert(!err, 'was success');\n      done();\n    });\n  });\n\n  it('some other test', function() {\n    // You can use mocha how you normally would to group tests\n  });\n});\n\ndvr.describe.skip('skipped test', function() {\n  // Anything in here will be skipped\n  // If the skip is removed, this request would be recorded for playback in\n  // later tests\n  it('makes request', function(done) {\n    request('http://localhost:4000/users', function(err, res, body) {\n      assert(!err, 'was success');\n      done();\n    });\n  });\n});\n```\n\n## Configuration\n\nList of [available configuration\noptions](https://github.com/poetic/nock-vcr-recorder#configuration)\n\n#### Test specific configuration\n\n```js\ndvr.it('works', {\n  mode: 'all'\n}, function(done) {\n  request('http://localhost:4000/users', function(err, res, body) {\n    assert(!err, 'was success');\n    done();\n  });\n});\n\ndvr.describe('works', { mode: 'all' }, function() {\n  it('makes request', function(done) {\n    request('http://localhost:4000/users', function(err, res, body) {\n      assert(!err, 'was success');\n      done();\n    });\n  });\n});\n```\n\n#### Global Configuration\n\nA `dvr.config` method is exposed to set default configuration on a global level.\nThis should be done before any of your tests have run. In mocha you can put this\nin a helper file.\n\n```js\nconst dvr = require('nock-dvr');\n\ndvr.config({\n  excludeScope: ['github.com']\n});\n```\n\n## Credit ##\n\n* [Jake Craige](http://twitter.com/jakecraige)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoffdutton%2Fnock-dvr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeoffdutton%2Fnock-dvr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoffdutton%2Fnock-dvr/lists"}