swc-node icon indicating copy to clipboard operation
swc-node copied to clipboard

Debugger will not stop at break points when using swc-jest

Open maxmil opened this issue 3 years ago • 2 comments

I think that this is because source maps must be generated inline.

A fix for this was proposed in #632, which set's the source map as inline for jest if it is undefined however it is not undefined by default.

I'm configuring jest in package.json using the preset

"jest": {
    "preset": "@swc-node/jest",
    ...
}

A workaround is to set it manually

"jest": {
  "transform": {
    "^.+\\.(t|j)sx?$": [
      "@swc-node/jest",
      {
        "swc": {
          "sourceMaps": "inline"
        }
      }
    ]
  },
  ...
}

I notice that when reading tsconfig it is given a default value. This may be the problem.

https://github.com/swc-project/swc-node/blob/8c180e68abbc66aa68f83b401d985a6c8617baa9/packages/register/read-default-tsconfig.ts#L99-L107

maxmil avatar May 14 '22 06:05 maxmil

Ran into the same issue, thanks for the workaround

mutoe avatar Oct 25 '22 03:10 mutoe