Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
With mocha/chai how can i make it show lines skipped?

I have a failing unit test that is comparing two large arrays, and the output from mocha is partially skipped.

         "Qualifying/Commissions/Amount"
         "Qualifying/Other/Amount"
         "Qualifying/Overtime/Amount"
         "Qualifying/Total/Amount"
      -  "Factors/De/ ... Lines skipped
      +  "Factors/De/Base/Amount"
      +  "Factors/De/Bo ... Lines skipped

How do I get more of the lines that were skipped? Pytest has a -v option for verbose.

This is the result of calling

expect(actual).to.deep.equal(expected)

where actual and expected are big ol' arrays of strings.

Versions:
"mocha": "^9.0.3",
"sinon-chai": "^3.5.0",
"chai": "~4.1",

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This one is pretty tricky, I met it as well.

TL;DR

go to node_modules/mocha/lib/reporters/base.js: 193 change const diffSize = 2048; to a larger one.

Details

The reason they limit the line size is because this issue: https://github.com/mochajs/mocha/issues/3675

and they solved with this PR: https://github.com/mochajs/mocha/pull/4638

the code associated is:

 const diffSize = 2048;
    if (actual.length > diffSize) {
      actual = actual.substring(0, diffSize) + ' ... Lines skipped';
    }
    if (expected.length > diffSize) {
      expected = expected.substring(0, diffSize) + ' ... Lines skipped';
    }

Thus, you will need to modify the diffSize to a larger one. Perhaps local dev only, try some patch hook if you wanna use it in other env.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda