Mocha Test Driver for Node-Machine Machinepacks

3.0.0 · abandoned · verified Sun Apr 19

test-machinepack-mocha is a specialized test driver designed to integrate Mocha with the `node-machine` ecosystem's machinepacks. It enables developers to run tests written in the machinepack's custom JSON format using the familiar Mocha test runner. The package is currently stable at version 3.0.0, but its upstream `node-machine` ecosystem and `test-machinepack-mocha` itself appear to be abandoned, with no significant updates or active development for several years. This means there is no active release cadence. Its key differentiator is its deep integration with `node-machine`'s specific testing methodology, making it suitable only for projects built within that framework. It's primarily used as a command-line interface (CLI) tool rather than being imported programmatically.

Common errors

Warnings

Install

Quickstart

Demonstrates global installation and usage of the `test-machinepack-mocha` CLI to run a basic test against a sample machinepack.

# First, install the driver globally (or locally for npx usage):
npm install -g test-machinepack-mocha

# Now, let's create a dummy machinepack and its test files.
# Create a directory for your machinepack:
mkdir my-simple-machinepack
cd my-simple-machinepack

# Create a dummy 'machine' file (e.g., index.js):
echo "module.exports = { friendlyName: 'Add Numbers', description: 'Adds two numbers.', inputs: { a: { type: 'number', required: true }, b: { type: 'number', required: true } }, exits: { success: { outputExample: 3 } }, fn: function (inputs, exits) { return exits.success(inputs.a + inputs.b); } };" > index.js

# Create a 'tests' directory and a test JSON file:
mkdir tests
echo '{
  "friendlyName": "Basic Addition",
  "machine": "./index.js",
  "inputs": {
    "a": 1,
    "b": 2
  },
  "expect": 3
}' > tests/add-basic.json

# Now, run the tests using the driver:
testmachinepack-mocha

view raw JSON →