Skip to content

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

Open
@maxmil

Description

@maxmil

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.

export function createSourcemapOption(options: ts.CompilerOptions) {
return options.sourceMap !== false
? options.inlineSourceMap
? 'inline'
: true
: options.inlineSourceMap
? 'inline'
: false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions