Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
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.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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("http://localhost:1331", function () {
  npm.load({registry: "http://localhost:1331"}, function () {
    npm.commands.install("/tmp", "underscore@1.3.1", function (err) {
      // assert npm behaves right...
    })
  })
})

Defining custom mock routes:

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

var customMocks = {
  "get": {
    "/mypackage": [500, function handler (uri, requestBody) { return {"ente200": "true" } }]
  }
}

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

##Todo

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

  • add more use-cases

Keywords

FAQs

Package last updated on 30 Jul 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc