To compare two arrays I am using deepEqual, but the issue is that the result of deepEqual is sporadic in nature. Even if the actual and expected results are equal it still fails sporadically.
I tried using equal to compare two arrays but it throws error like “Diff suppressed as the expected and actual results have an equivalent serialization”.
I checked the datatype of actual and expected using Array.isArray(actual) and Array.isArray(expected) and both resulted “true” as an answer.
So to compare two arrays (simple and nested both) what is the best way?
DeepEqual has never been sporadic to me. Can you share an example?
The array contains hundreds of items, in the test result it looks like:
expected: [
“a”,
“b”,
“5c”,
“5d”,
“e”,
“f”,…]
Result: [
“a”,
“b”,
“5c”,
“5d”,
“e”,
“f”,…]
Diff: [
“a”,
“b”,
“5c”,
“5d”,
“e”,
“f”,…]
Let me know if you want an example in codepen.
yeah, a codepen would help us figure out what is going wrong. Thanks!