-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An option to disable enhanced assertion messages #2289
Comments
I think a better solution is some kind of smart limits for the formatted. Maybe check out how Jest formats such a thing. |
Friendly ping :) |
Which assertions are you seeing this with? |
|
It'd be useful to know how each assertion behaves. I must admit I've forgotten by now. |
No worries :) I'll send a PR when I have more time. |
I'm still seeing this and this is extremely annoying. test.only('blah blah blah', t => {
const a = {};
const b = {};
for (let i = 0; i < 1000; i++) {
a[i] = Math.random();
b[i] = Math.random();
}
t.is(a, b); // t.deepEqual works too
}); test.only('blah blah blah 2', t => {
let string = '';
for (let i = 0; i < 2000; i++) {
string += 'data\n';
}
const a = {
string: ''
};
const b = {
string
};
t.is(a, b); // t.deepEqual works too
}); |
Yes that's a lot of output! Specifically in your case a lot of what's being shown is enumerable internals, but it's not really AVA's place to decide not to show enumerable properties. What would you prefer here? I suppose we could stop printing the diff after N lines? But that would depend on whether we've shown any difference yet. Maybe it's OK as long as there's some sort of option to override. One might say This seems related to concordancejs/concordance#12. |
One solution would be to an add option to always truncate symbols like in the very end of the paste above:
The other solution is almost the same you've proposed. Instead of stopping printing, just truncate the main object like in the example above if it's diff exceeds N lines. |
It is, but in this example I don't care about the number of the properties. If it tells me that the exact 2 properties among the 1000 are different then I can easily perform debugging. |
If this would be very CPU expensive and/or very slow, we can go with the number of properties. In that case, there should be an option to limit the depth. |
I think concordancejs/concordance#12 should "collapse" equal properties / items over a certain threshold. Then in AVA, eventually, This really needs to be dealt with in Concordance first, though.
Performance is less relevant for failing tests. Tests tend to pass. |
The object can have a property with
data\n
x 1000.The text was updated successfully, but these errors were encountered: