{"id":22282573,"url":"https://github.com/carbonfive/nock-vcr","last_synced_at":"2025-04-12T00:02:33.170Z","repository":{"id":6591222,"uuid":"7833944","full_name":"carbonfive/nock-vcr","owner":"carbonfive","description":"Automate the recording and plack-back functionality provided by nock.","archived":false,"fork":false,"pushed_at":"2013-01-28T03:52:24.000Z","size":111,"stargazers_count":28,"open_issues_count":5,"forks_count":4,"subscribers_count":71,"default_branch":"master","last_synced_at":"2025-03-25T19:51:22.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carbonfive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-26T05:31:16.000Z","updated_at":"2021-12-15T08:06:53.000Z","dependencies_parsed_at":"2022-09-15T16:21:45.496Z","dependency_job_id":null,"html_url":"https://github.com/carbonfive/nock-vcr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Fnock-vcr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Fnock-vcr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Fnock-vcr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Fnock-vcr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carbonfive","download_url":"https://codeload.github.com/carbonfive/nock-vcr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248458819,"owners_count":21107157,"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-12-03T16:33:35.608Z","updated_at":"2025-04-12T00:02:33.137Z","avatar_url":"https://github.com/carbonfive.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"#Nock-VCR\n\nLike the Ruby [VCR][VCR] gem, record your test-suite's HTTP interactions\nand replay them during future runs for speedy, deterministic, and\naccurate tests. Built atop [nock][nock]'s testing and recording\ncapability.\n\n## Installation\n\n```sh\nnpm install nock-vcr\n```\n\n## Usage\n\nIn your tests, require nock-vcr. Then use \u003ccode\u003einsertCassette\u003c/code\u003e to\nmark the start of where recording - and later playback - should begin\nand \u003ccode\u003eejectCassette\u003c/code\u003e where it should end. Recorded \"cassettes\"\n\\- [nock][nock] code to mock the transactions - will be saved under\n\u003ccode\u003etest/cassettes\u003c/code\u003e!\n\nFor example:\n\n```coffeescript\nnvcr = require 'nock-vcr'\n\nfs = require 'fs'\nhttp = require 'http'\n\nrequestComplete = false\n\ndescribe 'using nock-vcr', -\u003e\n  context 'insert a cassette, and eject it when it is done', -\u003e\n    beforeEach (done)-\u003e\n      nvcr.insertCassette 'Your cassette name here'\n      options = method: 'GET', host: 'google.com', port: 80, path: '/'\n      http.request(options, (res)=\u003e\n        res.on 'end', =\u003e\n          requestComplete = true\n          nvcr.ejectCassette()\n          done()\n      ).end()\n\n    it 'creates a cassette', -\u003e\n      expect(requestComplete).to.be.true\n```\n\nYou can force nock-vcr to record all the time by passing and setting a\n\u003ccode\u003erecord\u003c/code\u003e option of \u003ccode\u003einsertCassette\u003c/code\u003e to the string\n\u003ccode\u003e'ALL'\u003c/code\u003e, or by setting the environment variable\n\u003ccode\u003eNOCK_VCR_MODE\u003c/code\u003e to the same value.\n\n## Notes\n\nCurrently this runs on top of [a modified version of nock][my-nock]\nthat corrects a bug in the code generated during recording as well as a\nway to re-activate mocking after a restore.\n\n## Upcoming Features\n\n* More options that can affect the recording behavior.\n* Hooks into popular testing frameworks.\n\n  [my-nock]: http://github.com/rudyjahchan/nock\n  [nock]: http://github.com/flatiron/nock\n  [vcr]: http://github.com/vcr/vcr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbonfive%2Fnock-vcr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarbonfive%2Fnock-vcr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbonfive%2Fnock-vcr/lists"}