Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda