diff --git a/packages/core/index.ts b/packages/core/index.ts index d72e376a8..98c747139 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -30,7 +30,6 @@ export interface Options { function transformOption(path: string, options?: Options, jest = false): SwcOptions { const opts = options == null ? {} : options opts.esModuleInterop = opts.esModuleInterop ?? true - const sourceMapDefault = jest ? 'inline' : true return { filename: path, jsc: { @@ -59,7 +58,7 @@ function transformOption(path: string, options?: Options, jest = false): SwcOpti type: options?.module ?? 'commonjs', noInterop: !opts.esModuleInterop, }, - sourceMaps: typeof opts.sourcemap === 'undefined' ? sourceMapDefault : opts.sourcemap, + sourceMaps: jest || typeof opts.sourcemap === 'undefined' ? 'inline' : opts.sourcemap, inlineSourcesContent: true, swcrc: false, ...(options?.swc ?? {}), diff --git a/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.md b/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.md index 003dc301d..2d52e3c46 100644 --- a/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.md +++ b/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.md @@ -10,7 +10,8 @@ Generated by [AVA](https://avajs.dev). `"use strict";␊ const Button = ({ text })=>/*#__PURE__*/ h("div", null, text);␊ - ` + ␊ + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICBjb25zdCBCdXR0b24gPSAoeyB0ZXh0IH0pID0+IChcbiAgICA8ZGl2PlxuICAgICAge3RleHR9XG4gICAgPC9kaXY+XG4gIClcbiJdLCJuYW1lcyI6WyJCdXR0b24iLCJ0ZXh0IiwiZGl2Il0sIm1hcHBpbmdzIjoiO0FBQ0UsTUFBTUEsU0FBUyxDQUFDLEVBQUVDLEtBQUksRUFBRSxpQkFDdEIsRUFBQ0MsYUFDRUQifQ==` ## should transform jsx into new jsx runtime @@ -24,4 +25,5 @@ Generated by [AVA](https://avajs.dev). const Button = ({ text })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {␊ children: text␊ });␊ - ` + ␊ + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICBjb25zdCBCdXR0b24gPSAoeyB0ZXh0IH0pID0+IChcbiAgICA8ZGl2PlxuICAgICAge3RleHR9XG4gICAgPC9kaXY+XG4gIClcbiJdLCJuYW1lcyI6WyJCdXR0b24iLCJ0ZXh0IiwiZGl2Il0sIm1hcHBpbmdzIjoiOzs7OztBQUNFLE1BQU1BLFNBQVMsQ0FBQyxFQUFFQyxLQUFJLEVBQUUsaUJBQ3RCLHFCQUFDQztrQkFDRUQifQ==` diff --git a/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.snap b/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.snap index bcf09aae5..822caef2a 100644 Binary files a/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.snap and b/packages/integrate/__tests__/react-pragma/__snapshots__/react-pragma.spec.ts.snap differ diff --git a/packages/jest/__test__/hoist-top-level.spec.ts.md b/packages/jest/__test__/hoist-top-level.spec.ts.md index 9ee3a4059..fe4325a60 100644 --- a/packages/jest/__test__/hoist-top-level.spec.ts.md +++ b/packages/jest/__test__/hoist-top-level.spec.ts.md @@ -40,4 +40,5 @@ Generated by [AVA](https://avajs.dev). console.log(bar);␊ jest.unmock('./bar/foo').dontMock('./bar/bar');␊ };␊ - ` + ␊ + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImplc3Quc3BlYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJcbmNvbnN0IGZvbyA9ICdmb28nXG5jb25zb2xlLmxvZyhmb28pXG5qZXN0LmVuYWJsZUF1dG9tb2NrKClcbmplc3QuZGlzYWJsZ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UFLWlgsS0FBS1EsTUFBTSxDQUFDLGFBQWFDLFFBQVEsQ0FBQztBQUdwQyJ9` diff --git a/packages/jest/__test__/hoist-top-level.spec.ts.snap b/packages/jest/__test__/hoist-top-level.spec.ts.snap index 6d1fa54ba..5ff823c2a 100644 Binary files a/packages/jest/__test__/hoist-top-level.spec.ts.snap and b/packages/jest/__test__/hoist-top-level.spec.ts.snap differ