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",
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.