Home Reference Source Test Repository

Function

Static Protected Summary
protected

Wether or not nvm exists.

protected

Makes a function hookable

protected

nvm(command: command): Promise

Process a nvm shell command as a Promise.

protected

nvmInstall(version: version, config: Object, hooks: Object): Promise

Install a Node version with nvm if needed

protected

nvmTest(version: version, config: Object, hooks: Object): Promise

Test using a Node version with nvm

protected

nvmTestVersion(version: version, config: Object, hooks: Object): Promise

Run test using a Node version via nvm

protected

nvmTestVersions(versions: version[], config: Object, hooks: Object): number

Run test using a list of Node versions with nvm.

protected

shell(command: command): ChildProcess | EventEmitter

Spawn a shell command with nvm shell.

Static Protected

protected exists(): boolean source

import {exists} from 'nvm-test/src/api/nvm.js'

Wether or not nvm exists.

Return:

boolean

Wether or not nvm exists

protected hookable(fn: function): Hookable source

import {hookable} from 'nvm-test/src/api/hooks.js'

Makes a function hookable

Params:

NameTypeAttributeDescription
fn function

A function to make hookable

Return:

Hookable

The Hookable function, Hooks as last arguments

Throw:

TypeError

When argument is not a function

protected nvm(command: command): Promise source

import {nvm} from 'nvm-test/src/api/nvm.js'

Process a nvm shell command as a Promise.

  • It will resolve on 'close' code not equals 0.
  • It will reject on 'error' and 'close' code equals 0.

Params:

NameTypeAttributeDescription
command command
  • optional
  • default: ''

A shell command

Return:

Promise

The nvm shell Promise

protected nvmInstall(version: version, config: Object, hooks: Object): Promise source

import {nvmInstall} from 'nvm-test/src/api/nvm-install.js'

Install a Node version with nvm if needed

Params:

NameTypeAttributeDescription
version version
  • optional
  • default: ''

A Node version to install with nvm

config Object
  • optional

A config

config.install {install: command}
  • optional
  • default: config.install

A config install command

hooks Object
  • optional

An Object of Hooks

hooks.nvmHooks {nvmHooks: Hooks}
  • optional

nvm Hooks

Return:

Promise

The nvm Promise

protected nvmTest(version: version, config: Object, hooks: Object): Promise source

import {nvmTest} from 'nvm-test/src/api/nvm-test.js'

Test using a Node version with nvm

Params:

NameTypeAttributeDescription
version version
  • optional
  • default: ''

A Node version to use with nvm

config Object
  • optional

A config

config.test {test: command}
  • optional
  • default: config.test

A config test command

config.dryRun {dryRun: boolean}
  • optional
  • default: config.dryRun

Wheter or not to dry run the test

hooks Object
  • optional

An Object of Hooks

hooks.nvmHooks {nvmHooks: Hooks}
  • optional

A nvm Hooks

Return:

Promise

The nvm Promise

protected nvmTestVersion(version: version, config: Object, hooks: Object): Promise source

import {nvmTestVersion} from 'nvm-test/src/api/nvm-test-version.js'

Run test using a Node version via nvm

Params:

NameTypeAttributeDescription
version version
  • optional
  • default: ''

A Node version to use with nvm

config Object
  • optional

A config

config.install {install: command}
  • optional
  • default: config.install

A config install command

config.test {test: command}
  • optional
  • default: config.test

A config test command

config.dryRun {dryRun: boolean}
  • optional
  • default: config.dryRun

Wheter or not to dry run the test

hooks Object
  • optional

An Object of Hooks

hooks.nvmInstallHooks {nvmInstallHooks: Hooks}
  • optional

nvmInstall Hooks

hooks.nvmTestHooks {nvmTestHooks: Hooks}
  • optional

nvmTest Hooks

Return:

Promise

The nvmTest Promise

protected nvmTestVersions(versions: version[], config: Object, hooks: Object): number source

import {nvmTestVersions} from 'nvm-test/src/api/nvm-test-versions.js'

Run test using a list of Node versions with nvm.

Params:

NameTypeAttributeDescription
versions version[]
  • optional
  • default: []

A list of Node versions to use with nvm

config Object
  • optional

A config

config.install {install: command}
  • optional
  • default: config.install

A config install command

config.test {test: command}
  • optional
  • default: config.test

A config test command

config.dryRun {dryRun: boolean}
  • optional
  • default: config.dryRun

Wheter or not to dry run the test

hooks Object
  • optional

An Object of Hooks

hooks.nvmTestVersionHooks {nvmTestVersionHooks: Hooks}
  • optional

nvmTestVersion Hooks

Return:

number

The process exit code

protected shell(command: command): ChildProcess | EventEmitter source

import {shell} from 'nvm-test/src/api/nvm.js'

Spawn a shell command with nvm shell.

Params:

NameTypeAttributeDescription
command command
  • optional
  • default: ''

A shell command to spawn

Return:

ChildProcess | EventEmitter

The spawned nvm command child process