LocalMachinepacks.addTest()

Add a test for a machine in a machinepack on the local disk.

Usage

Hover over inputs/exits for more info.

var LocalMachinepacks = require('machinepack-localmachinepacks');


// Add a test for a machine in a machinepack on the local disk.

LocalMachinepacks.addTest({

dir: '/Users/mikermcneil/machinepack-foo/',

identity: 'do-stuff-and-things',

using: {},

outcome: 'foobar',

returns: '*',

before: 'function before (done) {\n done(); \n}',

after: 'function after (done) {\n done(); \n}',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// A test suite file exists, but it is corrupted. Please fix or delete it manually.

corrupted: function (result) {

 

},

// OK.

success: function () {

 

},

});

Inputs

dir required

The path to the machinepack (if path is not absolute, will be resolved from the current working directory)

'/Users/mikermcneil/machinepack-foo/'
identity required

The identity of the machine for whom a test will be generated.

'do-stuff-and-things'
using required

An input configuration for this machine.

{}
outcome required

Expected outcome (exit triggered) from the provided input configuration.

'foobar'
returns

Expected return value from the provided input configuration.

'*'
before

A stringified function that will be used as the "before" for Mocha.

'function before (done) {\n done(); \n}'
after

A stringified function that will be used as the "after" for Mocha.

'function after (done) {\n done(); \n}'

Exits

error

An unexpected error occurred.

corrupted

A test suite file exists, but it is corrupted. Please fix or delete it manually.

'/foo/bar/machinepack-baz/tests/do-stuff-and-things.json'
success

OK.