'Mocha + Chai: Continue and try all assertions after failure for the test

I would like the test runner to continue testing the whole it test even after the assertion fails.

const { assert } = require('chai');

describe('Test suite', () => {
  it('Test 1', () => { // test fail
    assert.equal(1, 1); // passed assertion
    assert.equal(3, 4); // failed assertion
    assert.equal(5, 6); // failed assertion
  });

  it('Test 2', () => { // pass
    assert.equal(2, 2); 
  });
});

If I run this test, Test 1 failed as expected, but it aborts and don't try other assertions after first failure, printing this error message:

  Test suite
    1) Test 1
    ✓ Test 2


  1 passing (6ms)
  1 failing

  1) Test suite
       Test 1:

      AssertionError: expected 3 to equal 4
      + expected - actual

      -3
      +4
      
      at Context.<anonymous> (test/specs/newspec.spec.js:6:12)
      at processImmediate (internal/timers.js:456:21)

I would like to get the failure information for assert.equal(5, 6) as well, can anyone suggest a good way to approach it? Split each assert in each it block is not an option as this was just a dummy example, but IRL the test is more complex.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source