Category Archives: Jest

Fixing Wrong Line Numbers While Debugging Tests Using Jest, Next.js, and Typescript

I was trying to debug some /pages/api functionality from /pages/api/__test__/my.test.ts but the debugger kept getting the wrong line numbers.

I ended up adding configuration as indicated by Prottoy2938’s comment about Testing with typescript + jest + ts-jest. The configuration is very similar to Next.js Setting up Jest (with Babel) instructions with some additional ts-jest setup.