Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 498 Bytes

Debugging in Jest.md

File metadata and controls

30 lines (25 loc) · 498 Bytes
title public tags date
Debugging in Jest
true
testing
jest
javascript
2021-04-14

Debugging in Jest

Add breakpoint in test:

  it.each`
    a    | b    | result
    ${1} | ${2} | ${3}
    ${0} | ${4} | ${4}
  `("should return $result when a = $a, b = $b", ({ a, b, result }) => {
    debugger; // breakpoint
    expect(sum(a, b)).toBe(result);
  });

Run this following command:

node --inspect-brk ./node_modules/.bin/jest ./<file_of_test>.test.js