pack and install your npm package into itself
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Pack and install your npm package into itself. This is useful if you want to run tests against the distributable that other npm users will be using, and not against the lib / dist in your own build.

Note: This may not work in newer versions of Node. To get a similar effect, run npm link; npm link <package-name>.


First install this package using npm

$ npm install localinstall --save-dev

Then edit your package.json to include the command before your tests

"scripts": {
  "pretest": "localinstall",
  "test": "your-tests-here"

Now, in your tests, you can test your package as if it was installed by an end user.

var mypackage = require('mypackage');