{"id":15290250,"url":"https://github.com/npm/npm-registry-mock","last_synced_at":"2026-01-11T06:51:55.984Z","repository":{"id":9446411,"uuid":"11324222","full_name":"npm/npm-registry-mock","owner":"npm","description":"mock the npm registry","archived":true,"fork":false,"pushed_at":"2022-12-10T21:08:09.000Z","size":529,"stargazers_count":27,"open_issues_count":0,"forks_count":16,"subscribers_count":24,"default_branch":"main","last_synced_at":"2024-10-01T16:06:33.965Z","etag":null,"topics":["npm-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-10T20:57:05.000Z","updated_at":"2023-08-25T22:33:44.000Z","dependencies_parsed_at":"2023-01-13T15:21:46.309Z","dependency_job_id":null,"html_url":"https://github.com/npm/npm-registry-mock","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-registry-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-registry-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-registry-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-registry-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npm","download_url":"https://codeload.github.com/npm/npm-registry-mock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235586070,"owners_count":19014028,"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":["npm-cli"],"created_at":"2024-09-30T16:06:36.993Z","updated_at":"2025-10-07T03:32:24.225Z","avatar_url":"https://github.com/npm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# npm-registry-mock\n\n\u003e **Warning**: This package is deprecated and the repo is archived. The `npm/cli` now uses https://github.com/npm/cli/tree/latest/mock-registry to mock registry requests for tests.\n\n## Mocked Packages\n\nCurrently mocked packages are:\n\n`underscore` at 1.3.1, 1.3.3 and 1.5.1 while version 1.5.1 is the latest in this mocked registry.\n\n`request` at 0.9.0, 0.9.5 and 2.27.0 while version 2.27.0 is the latest in this mocked registry.\n\n`test-package-with-one-dep` at 0.0.0, with mocked dependency `test-package@0.0.0`.\n\n`npm-test-peer-deps` at 0.0.0, with a peer dependency on `request@0.9.x` and a dependency on `underscore@1.3.1`.\n\n`test-repo-url-http` at 0.0.0\n\n`test-repo-url-https` at 0.0.1\n\n`test-repo-url-ssh` at 0.0.1\n\n`mkdirp` at 0.3.5\n\n`optimist` at 0.6.0\n\n`clean` at 2.1.6\n\n`async` at 0.2.9, 0.2.10\n\n`checker` at 0.5.1, 0.5.2\n\n## Usage\n\nInstalling underscore 1.3.1:\n\n```javascript\nvar mr = require(\"npm-registry-mock\")\n\nmr({port: 1331}, function (err, s) {\n  npm.load({registry: \"http://localhost:1331\"}, function () {\n    npm.commands.install(\"/tmp\", \"underscore@1.3.1\", function (err) {\n      // assert npm behaves right...\n      s.close() // shutdown server\n    })\n  })\n})\n```\n\nDefining custom mock routes:\n\n```javascript\nvar mr = require(\"npm-registry-mock\")\n\nvar customMocks = {\n  \"get\": {\n    \"/mypackage\": [500, {\"ente\" : true}]\n  }\n}\n\nmr({port: 1331, mocks: customMocks}, function (err, s) {\n  npm.load({registry: \"http://localhost:1331\"}, function () {\n    npm.commands.install(\"/tmp\", \"mypackage\", function (err) {\n      // assert npm behaves right with an 500 error as response...\n      s.close() // shutdown server\n    })\n  })\n})\n```\n\nLimit the requests for each route:\n\n```javascript\nmr({\n    port: 1331,\n    minReq: 1,\n    maxReq: 5\n  }, function (err, s) {\n\n```\n\n## Adding a new fixture\n\nAlthough ideally we stick with the packages already mocked when writing new tests, in some cases it can be necessary to recreate a certain pathological or unusual scenario in the mock registry. In that case you can run\n\n```sh\n$ ./add-fixture.sh my-weird-package 1.2.3\n```\n\nto add that package to the fixtures directory.\n\n## Breaking Changes for 1.0\n - the callback returns `err, server` now, instead of just server (https://github.com/npm/npm-registry-mock/issues/20)\n - options must be of type `object`\n - a \"plugin\" is injected via options.plugin, not as a mock being a function\n - a plugin does not override the default routes any more\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-registry-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpm%2Fnpm-registry-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-registry-mock/lists"}