mock-package-install

mock-package-install

Source:

Methods

(static) install(opts) → {object}

Installs mock package into node_modules & updates the corresponding package.json file

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
package object <optional>

JS object package.json. random package used if none provided

nodeModulesDir string <optional>

path to node_modules dir to install mock package into. looks for cwd/node_modules by default

targetPackage string <optional>

path to package.json file to update with the newly installed dependency's metadata

isDev boolean <optional>

put into devDependencies vs dependencies. used only with targetPackage

Returns:
Type:
object

JS object package.json

Example
mock.install({
  package: { name: 'TEST_NAME', version: 'TEST_VERSION' },
  nodeModulesDir: '/path/to/target/node_modules',
  targetPackage: '/path/to/target/package.json',
  isDev: true
})

(static) remove(opts)

remove mock package

Source:
Parameters:
Name Type Description
opts object
Name Type Attributes Description
name string

package name to remove

package.name string <optional>

may be used instead of opts.name for consistency w/ install API

nodeModulesDir string <optional>

path to node_modules dir

targetPackage string <optional>

path to package.json file to update with the newly installed dependency's metadata

isDev boolean <optional>

put into devDependencies vs dependencies. used only with targetPackage