How to add custom message to Jest expect? - Stack Overflow
https://stackoverflow.com/questions/45348083/how-to-add-custom-message-to-jest-expect
WEBJul 27, 2017 · Although it's not a general solution, for the common case of wanting a custom exception message to distinguish items in a loop, you can instead use Jest's test.each. For example, your sample code: it('valid emails checks', () => {. ['[email protected]', '[email protected]'/*, ...*/].map(mail => {. expect(isValid(mail)).toBe(true); }); });
DA: 67 PA: 26 MOZ Rank: 35