Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ function AssertDiff() {

AssertDiff.options = {strict: false};

const AsyncFunction = (async function() {}).constructor;

Object.keys(assert).forEach(function(k) {
let fun = assert[k];
AssertDiff[k] = async function() {
return fun.apply(fun, arguments);
};
AssertDiff[k] = fun.constructor instanceof AsyncFunction ?
async function() {
return fun.apply(fun, arguments);
} :
function() {
return fun.apply(fun, arguments);
};
});

export const deepStrictEqual = AssertDiff.deepStrictEqual = function deepStrictEqual() {
Expand Down
4 changes: 4 additions & 0 deletions test/example-passing-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,8 @@ it('async functions', async function() {
})
}))
assert.ok(c);

assert.throws(function() {
assert.equal(1, 2, 'should be able to throw outside of async functions too');
});
})