A tool for running tape tests in multiple files
tape is a very useful framework for doing unit tests in node.js. It is normally used to run tests with
tape test/*.js
This has one very nasty gotcha however. Since it runs all tests in a single node instance, global variables and mocks will spread between the tests in an uncontrolled manner.
multi-tape solves this by running each js-file in a separate node-process.
Write your tape-based tests in several js-files. Then run
npm install multi-tape
./node_modules/.bin/multi-tape test/*.js
to actually run the tests. This will run the test-files in alphabetical order, with output sent to stdout and print a summary at the end
-
-o send output to one file per test-file. The output filename will be the name of the test-file with '.tap' appended. The result will still be printed to STDOUT.
-
--node-arg=--opt Send an option to node when invoking the test-file. Can be used more than once.
-
-p=X Run X tests in parallel. If X > 1, the output from each test is buffered until the test is finished. Without this, the output from different tests would be mixed.
multi-tape exits with code 1 if any test failed as shown by the tap-results or if any test-script exited with a non-zero code.