const assert = require('assert/strict');
assert.throws(
() => {
throw new Error('Wrong value');
},
Error
);
import assert from 'assert/strict';
assert.throws(
() => {
throw new Error('Wrong value');
},
/^Error: Wrong value$/
);
const assert = require('assert/strict');
assert.doesNotThrow(
() => {
throw new TypeError('Wrong value');
},
/Wrong value/,
'Whoops'
);
// Throws: AssertionError: Got unwanted exception: Whoops