7a001447a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
const assert = require('assert') module.exports = { assertRejects, } // assert.rejects added in node v10 async function assertRejects (asyncFn, regExp) { let f = () => {} try { await asyncFn() } catch (error) { f = () => { throw error } } finally { assert.throws(f, regExp) } }