Home Reference Source Test Repository


Test using differents Node versions with nvm.

Configurable & Extensible npm test using differents Node versions with nvm.

NPM Package Stats
NPM Version Build Status Code Climate Coverage Status
JS Style Dependencies Dev Dependencies

  nvm-test [versions] [options]  Test using Node [versions]
  nvm-test <command>  [options]  Execute the <command> plugin

  -h, --help       Show help                                          [boolean]
  -i, --install    Specify the install command                         [string]
  -t, --test       Specify the test command                            [string]
  -D, --dry-run    Dry run the test                                   [boolean]
  -L, --log-level  Set the log level                                   [string]
  -v, --version    Show version number                                [boolean]

By default it runs 2 (configurable) sub commands as Promises:


Prefer global install:
npm install nvm-test -g

Or simply install as per project dev dependencies:
npm install --save-dev nvm-test

CLI usage

nvm-test [versions] [options]

Test using Node [versions]

Testing stable and v4 Node versions:

$ nvm-test stable v4 [options]

Test using the Node version from .nvmrc file (default nvm behavior):

$ nvm-test [options]

nvm-test <command> [options]

Execute the <command> plugin

Therefore the plugin must be available and installed in your project.
For example, install the travis plugin:

$ npm install nvm-test-plugin-travis

Add it to your .nvmrc.test.json project file:

  "plugins": ["travis"]

Then run the test using the Node versions from your .travis.yml file:

$ nvm-test travis [options]

CLI options

-i, --install

Specify the install command

$ nvm-test -i "nvm install $version" [versions]
$ nvm-test --install "nvm install $version" [versions]

Default: nvm which $version &> /dev/null || nvm install $version
The Node version will be silently installed if needed.

-t, --test

Specify the test command

$ nvm-test -t "npm test" [versions]
$ nvm-test --test "npm test" [versions]

Default: npm test
Just run the npm test script.

-D, --dry-run

Dry run the test
Just echoes the test command option for now

$ nvm-test -D [versions]
$ nvm-test --dry-run [versions]

-L, --log-level

Set the log level

$ nvm-test -L info [versions]
$ nvm-test --log-level info [versions]

Default: info, silly w/ NODE_ENV=development
Can be one of: silent, error, warn, info, verbose, or silly

-h, --help

Show help

$ nvm-test -h
$ nvm-test --help

Show the <command> plugin help

$ nvm-test <command> -h
$ nvm-test <command> --help

-v, --version

Show nvm-test version number

$ nvm-test -v
$ nvm-test --version

JavaScript API usage

See the API documentation on GitHub