Overview
tape-filter is a tapejs decorator that adds the capability to filter test cases.
Installation
npm install tape-filter
API
The module's API consists of a single function that requires a tapejs implementation to decorate, as well as an optional expression by which to filter tests. If an expression is not provided, the process's "test-filter" argument will be used, and if neither is provided, no tests will be filtered.
/** * Returns a decorated tapejs implementation with test filtering support * @param * @param */module { ...}
Usage Example
The following sections display the effect of the command-line argument test filtering.
Unit Test Source:
const tape = ;const test = tape; { return 123;} { return 321;} ; ;
Shell command without filtering:
[user@box:~/project$] node test.js TAP version 13# foo should return 123 ok 1 should be equal# bar should return 321 ok 2 should be equal 1..2# tests 2 # pass 2 # ok
Shell command with filtering:
[user@box:~/project$] node test.js --test-filter=".*foo.*"TAP version 13# foo should return 123 ok 1 should be equal 1..1# tests 1 # pass 1 # ok