Closed ninevra closed 3 years ago
I'm not sure whether this is the intended behavior or not.
Retroactively… yes? I'm not sure what else to do with this, it's hard to set an arbitrary cap on iteration steps. What do you think?
I'm not sure? It wouldn't make sense to consider only a finite number of elements, but I suppose one could throw after a configurable number of steps.
Traversing iterables at all seems odd to me, since stateful iterables could produce strange results and async iterables aren't (and can't be) treated similarly, but that's a done design decision. (Looking at other libraries, chai
and jest
likewise traverse iterables, lodash
just declares them equal for some reason, and node
assert
compares them by reference / identity.)
describe()
and compare()
seem to work fine with infinite iterables (unless compare receives two equal infinite iterables, of course). It might be possible to improve on this slightly by setting a configurable maximum iterations cap for at least diff()
and format()
, so that AVA could produce sensible output in slightly more cases. Doesn't seem worth the work, though, since assertions on infinite iterables will never pass.
I'll close this issue.
concordance
attempts to traverse iterables to completion, so that it can compare and/or describe their elements. This means thatcompare
,diff
,format
, andserialize
loop infinitely when called with infinite iterables.This can cause AVA tests to time out, even on comparisons that can be completed in finite time, such as
I'm not sure whether this is the intended behavior or not.