Skip to content

Mocha failing when error message too big #3675

@furstenheim

Description

@furstenheim

Description

Mocha never ends with big error messages

Steps to Reproduce

const {expect} = require('chai')
 it('Test failing', function () {
      const longArray = _.times(10000, function (i) {
        return {a : i}
      })
      const shortArray = []
      expect(longArray).deep.equal(shortArray)
})

Then execute yarn mocha test --exit, the test will execute it will be marked as failure, but the summary will never appear and the process will not exit.

If on contrary one writes:

const {expect} = require('chai')
 it('Test failing', function () {
      const longArray = _.times(10000, function (i) {
        return {a : i}
      })
      const shortArray = []
      try {
        expect(longArray).deep.equal(shortArray)
     } catch (e) {
        console.error(e)
        throw new Error('Small error')
     }
})

The test fails and it displays an error in the summary. Error is logged without any problem.

Expected behavior: [What you expect to happen]
Mocha should be able to exit the process even if the error is overly long. Maybe the message could be reduced?

Actual behavior: [What actually happens]
The process hangs forever

Reproduces how often: [What percentage of the time does it reproduce?]
Always

Versions

Mocha 5.1.1

  • The output of mocha --version and node node_modules/.bin/mocha --version:
  • The output of node --version:
    v8.11.2
  • The version and architecture of your operating system:
    Ubuntu
  • Your shell (bash, zsh, PowerShell, cmd, etc.):
    bash
  • Your browser and version (if running browser tests):
  • Any other third party Mocha related modules (with versions):
  • The code transpiler being used:

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency filetype: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions