-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the best way to use testdouble.js with tape? #93
Comments
Forgive my naivety, but what does tape do when a function passed to const test = require('tape');
const td = require('testdouble');
test('verify invoked', function(t) {
t.plan(1)
var stub = td.create()
stub('any arguments', 0, 1, 2)
td.verify(stub())
}) |
@searls Because we called |
@d6u, can you use |
Just tried. |
That's right. I meant more like this (dropping const test = require('tape');
const td = require('testdouble');
test('verify invoked', function(t) {
var stub = td.create()
stub('any arguments', 0, 1, 2)
td.verify(stub())
t.end()
}) Does that work for your situation? |
This should work. Thanks. To push this further, could testdouble.js hook up with tape and let tape count each |
We have a couple other plugins that hook |
Thanks |
Because |
If you really want to use const test = require('tape');
const td = require('testdouble');
const SUT = require(/* … */); // Subject Under Test
test('Hello World!', t => {
t.plan(1);
const fn = td.func();
SUT(fn, 42);
td.verify(fn(42));
t.pass('fn was applied to 42'); // <-- Counts towards t.plan
t.end();
}); TAP Output:
|
I saw #33 but it's quite verbose to use testdouble with tape:
Anyway to not pass a callback to
t.doesNotThrow
?Thanks!
The text was updated successfully, but these errors were encountered: