How to add custom message to Jest expect?

前端 未结 8 1210
鱼传尺愫
鱼传尺愫 2021-02-03 17:35

Image following test case:

it(\'valid emails checks\', () => {
  [\'abc@y.com\', \'a@b.nz\'/*, ...*/].map(mail => {
    expect(isValid(mail)).toBe(true);
          


        
8条回答
  •  孤街浪徒
    2021-02-03 17:54

    You try this one: https://github.com/mattphillips/jest-expect-message

    test('returns 2 when adding 1 and 1', () => {
      expect(1 + 1, 'Woah this should be 2!').toBe(3);
    });
    

提交回复
热议问题