Consider this script:
const mySet = new Set([1, 2, 3]); mySet.filter(i => i < 3);
In the browser this code throws mySet.filter is not a function error.
Yet when this code runs in a Jest test – it works.
Does somebody know why this happens and what should I do if I want my test to detect this bug?
I know how to fix the code so it does not throw. My question is how do I make the test throw and fail on this code.