Skip to content

Unhandled rejection error on "t.throws()" test of trivial async function #1371

@sdd

Description

@sdd

Description

Unhandled rejection error on test of async function that throws

Test Source

import test from 'ava'; const f = async () => { throw new Error(); }; test(async t => { const error = await t.throws(async () => { return await f(); }); t.is(error.message, ''); });

Error Message & Stack Trace

1 failed [08:28:15] 1 rejection test › [anonymous] /Users/scotty/workspace/fetch-nice/test/test.js:9 8: 9: const error = await t.throws(async () => { 10: return await f(); Test.<anonymous> (test/test.js:9:27) step (test/test.js:9:191) Test.<anonymous> (test/test.js:9:99) Test.__dirname [as fn] (test/test.js:7:1) Unhandled Rejection Error test/test.js:4:11 Generator.next (<anonymous>) step (test/test.js:9:191) test/test.js:9:437 test/test.js:9:99 f (test/test.js:3:7) test/test.js:10:22 Generator.next (<anonymous>) step (test/test.js:9:191) test/test.js:9:437 test/test.js:9:99 _tryBlock (node_modules/core-assert/index.js:311:5) _throws (node_modules/core-assert/index.js:330:12) Function.assert.throws (node_modules/core-assert/index.js:360:3) Test.<anonymous> (test/test.js:9:27) Generator.next (<anonymous>) step (test/test.js:9:191) test/test.js:9:437 Test.<anonymous> (test/test.js:9:99) Test.__dirname [as fn] (test/test.js:7:1) 

Config

{ "ava": { "require": [ "babel-register", "babel-polyfill" ] } }

Command-Line Arguments

ava -w 

Environment

Node.js v7.6.0
darwin 15.6.0
ava 0.19.1
npm 4.1.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions