Debugging in Jest
Add breakpoint in test:
1
2
3
4
5
6
7
8
| 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:
1
| node --inspect-brk ./node_modules/.bin/jest ./<file_of_test>.test.js
|