1

As per the official documentation, assert.rejects was added since Node v10.0.0.

Also, the node console confirms that:

enter image description here

even though, truffle test throws this error:

 TypeError: assert.rejects is not a function

Because I wrote this snippet in my unit-tests:

  await assert.rejects(async () => {
    await this.contract.createToken(...info, 1, {from: accounts[0]});
  });
1

Fixed by importing assert explicitly at the top of the test file:

const assert = require('assert');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.