📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

npm-registry-mock

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-registry-mock

mock the npm registry

0.3.0
Source
npm
Version published
Weekly downloads
25K
-4.94%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Dependency Status

#npm-registry-mock

##Usage

Currently mocked packages are underscore at 1.3.1 and 1.5.1 while version 1.5.1 is the latest in this mocked registry.

Installing underscore 1.3.1:

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

mr(1331, function (s) {
  npm.load({registry: "http://localhost:1331"}, function () {
    npm.commands.install("/tmp", "underscore@1.3.1", 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 (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
    })
  })
})

##Todo

  • extending the routes with the custom ones, no complete overrides

  • add more use-cases

Keywords

npm

FAQs

Package last updated on 25 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts