3.0.1 • Published 6 years ago

test-machinepack v3.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

test-machinepack

Raw test runner for machinepacks (also includes a generic driver)

Note that this built-in test driver is pretty basic-- I wouldn't recommend using it. There is a better driver for mocha that you might enjoy: https://github.com/mikermcneil/test-machinepack-mocha The point of this module is mainly to expose a test runner.

Confused? See http://node-machine.org for documentation.

Installation

npm install -g test-machinepack

Usage

You can use the generic driver to run tests. To do that, just cd into your machinepack and then run:

testmachinepack

Writing tests

Tests will be written in JSON or JSON5 format (with .json5 file ending). For each machine you have define you create a JSON file with the same name within a tests folder. If you install machinepack and run pm scrub skeleton files will be created for you.

The general format looks like this:

//machine-name.json, or machine-name.json5 if you want comment support
{
  //name of the machine as per filename
  "machine": "machine-name",
  //within expectations you define the tests of your machine
  //based on the inputs and exits you have defined
  "expectations": [
    {
      //todo truthy means the test will be skipped
      "todo": true,
      "using": {
        "variable1": ""
      },
      "outcome": ""
    },
    {
      "using": {
        "variable1": "value"
      },
      "outcome": "error"
    },
    {
      "using": {
        "variable": "value1",
        "variable2": "value2"
      },
      "outcome": "error"
    }
  ]
}

So what do real tests look like? Check out this example from machinepack-npm: https://github.com/mikermcneil/machinepack-npm/blob/master/tests/list-packages.json

Custom drivers

Want to build a driver for the test framework of your choice? See https://github.com/mikermcneil/test-machinepack-mocha for an example, and check out the files in this repo to see how the driver interface is exposed.

License

MIT

© 2015-2017 Mike McNeil

3.0.1

6 years ago

2.1.22

7 years ago

2.1.21

7 years ago

2.1.20

7 years ago

2.1.19

7 years ago

2.1.18

7 years ago

2.1.17

7 years ago

2.1.16

7 years ago

2.1.15

7 years ago

2.1.14

7 years ago

2.1.13

7 years ago

2.1.12

8 years ago

2.1.11

8 years ago

3.0.0

8 years ago

2.1.10

8 years ago

2.1.9

8 years ago

2.1.8

8 years ago

2.1.7

8 years ago

2.1.6

8 years ago

2.1.4

9 years ago

2.1.3

9 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.1

9 years ago