{"id":16124155,"url":"https://github.com/itaditya/nock-with-jest","last_synced_at":"2026-04-28T13:37:29.679Z","repository":{"id":99907664,"uuid":"135062828","full_name":"itaditya/nock-with-jest","owner":"itaditya","description":"A simple demo to showoff Nock usage with Jest","archived":false,"fork":false,"pushed_at":"2018-05-27T16:25:52.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-06T12:26:38.435Z","etag":null,"topics":["api-test","api-testing","http-interceptor","jest","jest-tests","nock","testing","testing-framework","testing-practices","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/itaditya.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-27T16:21:06.000Z","updated_at":"2023-10-25T06:27:53.000Z","dependencies_parsed_at":"2023-05-11T00:30:16.733Z","dependency_job_id":null,"html_url":"https://github.com/itaditya/nock-with-jest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itaditya/nock-with-jest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Fnock-with-jest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Fnock-with-jest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Fnock-with-jest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Fnock-with-jest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itaditya","download_url":"https://codeload.github.com/itaditya/nock-with-jest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Fnock-with-jest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261434132,"owners_count":23157204,"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":["api-test","api-testing","http-interceptor","jest","jest-tests","nock","testing","testing-framework","testing-practices","testing-tools"],"created_at":"2024-10-09T21:19:56.260Z","updated_at":"2026-04-28T13:37:29.608Z","avatar_url":"https://github.com/itaditya.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A simple demo to showoff Nock usage with Jest\n\n## Explainer\n\n1. **index.js** is a module which sends requests to the server and this module has to be tested.\n1. **server.js** is used to create a server which responds with a delay of 1600 ms.\n1. **test/withoutnock.test.js** contains test which when run, lets the module send actual requests to server.\n1. **test/withnock.test.js** contains test which when run, intercepts the request made by the module.\n\n## How To Run\n\n1. Open server using `npm run server`.\n1. Run tests in watch mode using `npm run test:watch`.\n\n## What to make of it\n\n1. When you run the tests you'll notice that **withoutnock.test.js** takes around 1600 ms to complete\n1. However, **withnock.test.js** takes around 5 ms only.\n1. Also if you monitor the server logs, they will show that only one request was received by the server when the tests were run.\n1. All this happens because in **withnock.test.js** nock intercepts the requests and don't actually send the request to server, hence don't wait 1600 ms for the server to respond.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaditya%2Fnock-with-jest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitaditya%2Fnock-with-jest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaditya%2Fnock-with-jest/lists"}