You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.2 KiB

requireable

Enables a module to require itself by name in tests

Build Status Coverage Status npm

Mocks the require command to include the current package when the the name from the current packages package.json is required.

Especially useful in tests if you want to require the package you're testing by name rather than relative paths.

Install

npm install --save-dev requireable

Usage

require('requirable');

That's it! require has now been patched and you can now do require('package-name').

AVA Usage

Some tests runners such as AVA can require packages automatically for you. If you're using AVA add the following to your package.json:

"ava": {
  "require": [
    "requireable"
  ]
},

You can now require your package in your AVA tests.

License

MIT © Luke Childs