Skip to content
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

t.rejects is documented to return a promise, but returns undefined instead #413

Closed
timmolendijk opened this issue Nov 8, 2017 · 1 comment

Comments

@timmolendijk
Copy link

timmolendijk commented Nov 8, 2017

About the rejects assert, the documentation claims:

it returns a Promise that resolves when it is completed

Source: https://github.com/tapjs/node-tap/blob/gh-pages/asserts/index.md#trejectspromise--fn-expectederror-message-extra

This seems not to be the case:

const tap = require('tap');

tap.test("where is my promise", async t => {
  t.type(t.rejects(Promise.reject(new Error())), Promise);
});

gives

TAP version 13
# Subtest: where is my promise
    ok 1 - expect rejected Promise # time=6.096ms {
        ok 1 - expect rejected Promise
        1..1
    }

    not ok 2 - type is Promise
      ---
      found: undefined
      wanted: Promise
      compare: ===
      at: {}
      ...

    1..2
    # failed 1 of 2 tests
not ok 1 - where is my promise # time=18.532ms

1..1
# failed 1 test
# time=26.419ms

I'm running node-tap v10.7.2 on Node v8.6.0

@isaacs
Copy link
Member

isaacs commented Nov 30, 2017

Fixed in v11. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants