All Projects → npm → npm-registry-mock

npm / npm-registry-mock

Licence: other
mock the npm registry

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Labels

Projects that are alternatives of or similar to npm-registry-mock

node-cli-boilerplate
🪓 Create node cli with this user friendly boilerplate
Stars: ✭ 17 (-34.62%)
Mutual labels:  npm-cli
npm-profile
Make changes to your npmjs.com profile via cli or library
Stars: ✭ 29 (+11.54%)
Mutual labels:  npm-cli
inflight
Add callbacks to requests in flight to avoid async duplication
Stars: ✭ 63 (+142.31%)
Mutual labels:  npm-cli
Cli
the package manager for JavaScript
Stars: ✭ 5,277 (+20196.15%)
Mutual labels:  npm-cli
Node Semver
The semver parser for node (the one npm uses)
Stars: ✭ 3,944 (+15069.23%)
Mutual labels:  npm-cli
run-script
Run a lifecycle script for a package (descendant of npm-lifecycle)
Stars: ✭ 29 (+11.54%)
Mutual labels:  npm-cli
lint
lint the npmcli way
Stars: ✭ 27 (+3.85%)
Mutual labels:  npm-cli
proggy
Progress bar updates at a distance
Stars: ✭ 12 (-53.85%)
Mutual labels:  npm-cli
pacote
npm fetcher
Stars: ✭ 179 (+588.46%)
Mutual labels:  npm-cli
parse-conflict-json
Parse a JSON string that has git merge conflicts, resolving if possible
Stars: ✭ 24 (-7.69%)
Mutual labels:  npm-cli
libnpmpublish
programmatically publish and unpublish npm packages
Stars: ✭ 44 (+69.23%)
Mutual labels:  npm-cli
config
Configuration management for https://github.com/npm/cli
Stars: ✭ 22 (-15.38%)
Mutual labels:  npm-cli
cacache
npm's content-addressable cache
Stars: ✭ 181 (+596.15%)
Mutual labels:  npm-cli
cmd-shim
The cmd-shim used in npm
Stars: ✭ 65 (+150%)
Mutual labels:  npm-cli
libnpmsearch
programmatic API for the shiny new npm search endpoint
Stars: ✭ 25 (-3.85%)
Mutual labels:  npm-cli
cross-post
Cross Post a blog to multiple websites
Stars: ✭ 66 (+153.85%)
Mutual labels:  npm-cli
git
a util for spawning git from npm CLI contexts
Stars: ✭ 48 (+84.62%)
Mutual labels:  npm-cli
fs-minipass
fs read and write streams based on minipass
Stars: ✭ 15 (-42.31%)
Mutual labels:  npm-cli

Build Status Dependency Status

#npm-registry-mock

##Mocked Packages

Currently mocked packages are:

underscore at 1.3.1, 1.3.3 and 1.5.1 while version 1.5.1 is the latest in this mocked registry.

request at 0.9.0, 0.9.5 and 2.27.0 while version 2.27.0 is the latest in this mocked registry.

test-package-with-one-dep at 0.0.0, with mocked dependency [email protected].

npm-test-peer-deps at 0.0.0, with a peer dependency on [email protected] and a dependency on [email protected].

test-repo-url-http at 0.0.0

test-repo-url-https at 0.0.1

test-repo-url-ssh at 0.0.1

mkdirp at 0.3.5

optimist at 0.6.0

clean at 2.1.6

async at 0.2.9, 0.2.10

checker at 0.5.1, 0.5.2

##Usage

Installing underscore 1.3.1:

var mr = require("npm-registry-mock")

mr({port: 1331}, function (err, s) {
  npm.load({registry: "http://localhost:1331"}, function () {
    npm.commands.install("/tmp", "[email protected]", function (err) {
      // assert npm behaves right...
      s.close() // shutdown server
    })
  })
})

Defining custom mock routes:

var mr = require("npm-registry-mock")

var customMocks = {
  "get": {
    "/mypackage": [500, {"ente" : true}]
  }
}

mr({port: 1331, mocks: customMocks}, function (err, s) {
  npm.load({registry: "http://localhost:1331"}, function () {
    npm.commands.install("/tmp", "mypackage", function (err) {
      // assert npm behaves right with an 500 error as response...
      s.close() // shutdown server
    })
  })
})

Limit the requests for each route:

mr({
    port: 1331,
    minReq: 1,
    maxReq: 5
  }, function (err, s) {

##Adding a new fixture

Although 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

$ ./add-fixture.sh my-weird-package 1.2.3

to add that package to the fixtures directory.

##Breaking Changes for 1.0

  • the callback returns err, server now, instead of just server (#20)
  • options must be of type object
  • a "plugin" is injected via options.plugin, not as a mock being a function
  • a plugin does not override the default routes any more
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].