Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spion/blue-tape
substack's tape test runner with promise support
https://github.com/spion/blue-tape
Last synced: 9 days ago
JSON representation
substack's tape test runner with promise support
- Host: GitHub
- URL: https://github.com/spion/blue-tape
- Owner: spion
- Created: 2013-10-10T16:49:35.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T10:41:32.000Z (about 4 years ago)
- Last Synced: 2024-04-26T01:03:51.273Z (7 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 205
- Watchers: 4
- Forks: 19
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### This project is no longer maintained.
The best option is to switch to a library that supports promises - either https://github.com/jprichardson/tape-promise or https://github.com/tapjs/node-tap - or perhaps its time to revisit https://github.com/substack/tape/issues/262 and add promise support to tape.
--------------
# blue-tape
Tape with promise support.
### Usage
Same as [tape](https://github.com/substack/tape), except if you return a promise from a test,
it will be checked for errors. If there are no errors, the test will end. Otherwise the test
will fail. This means there is no need to use `t.plan()` or `t.end()`.Also provides `t.shouldFail(promise P, optional class|regex expected, optional message)` (as
well as the alias `shouldReject`) which returns a new promise that resolves successfully if `P`
rejects. If you provide the optional class, or regex then it additionally ensures that `err` is
an instance of that class or that the message matches the regular expression. The behaviour is
identical to tape's `throws` assertion.### Examples
Assuming `delay()` returns a promise:
```js
const test = require('blue-tape');test("simple delay", function(t) {
return delay(1);
});test("should fail", function(t) {
return delay(1).then(function() {
throw new Error("Failed!");
});
});
```Assuming `failDelay()` returns a promise that rejects with a DerpError:
```js
test("promise fails but test succeeds", function(t) {
return t.shouldFail(failDelay(), DerpError);
});
```### License
MIT