@sentry/wizard 6.12.0 → 6.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/bin.js +16 -1
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/angular-17.test.js +3 -4
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +3 -4
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +60 -0
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +8 -3
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.js +3 -6
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -2
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/android/android-wizard.js +3 -0
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +1 -1
- package/dist/src/angular/codemods/main.js +0 -1
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -3
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -1
- package/dist/src/apple/check-installed-cli.js +13 -7
- package/dist/src/apple/check-installed-cli.js.map +1 -1
- package/dist/src/apple/configure-xcode-project.js +8 -1
- package/dist/src/apple/configure-xcode-project.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
- package/dist/src/apple/lookup-xcode-project.js +22 -17
- package/dist/src/apple/lookup-xcode-project.js.map +1 -1
- package/dist/src/apple/options.d.ts +5 -0
- package/dist/src/apple/options.js.map +1 -1
- package/dist/src/apple/sentry-swift-package.d.ts +4 -0
- package/dist/src/apple/sentry-swift-package.js +17 -0
- package/dist/src/apple/sentry-swift-package.js.map +1 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +59 -1
- package/dist/src/apple/xcode-manager.js +507 -106
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -0
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +12 -6
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +12 -6
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +93 -52
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.js +8 -7
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +13 -19
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +2 -2
- package/dist/src/react-router/sdk-setup.js +16 -15
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +1 -3
- package/dist/src/react-router/templates.js +24 -92
- package/dist/src/react-router/templates.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -2
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +4 -1
- package/dist/src/run.js +13 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +12 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -1
- package/dist/src/utils/clack/index.js +17 -6
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/files.d.ts +2 -0
- package/dist/src/utils/files.js +58 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/git.d.ts +3 -1
- package/dist/src/utils/git.js +2 -1
- package/dist/src/utils/git.js.map +1 -1
- package/dist/src/utils/line-endings.d.ts +1 -0
- package/dist/src/utils/line-endings.js +76 -0
- package/dist/src/utils/line-endings.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +0 -5
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/lookup-xcode-project.test.js +167 -0
- package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
- package/dist/test/apple/xcode-manager.test.js +452 -43
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/constants.test.d.ts +1 -0
- package/dist/test/constants.test.js +12 -0
- package/dist/test/constants.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +66 -33
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +66 -36
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-router/codemods/client-entry.test.js +15 -11
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +21 -8
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +46 -10
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +26 -64
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/remix/build-script.test.d.ts +1 -0
- package/dist/test/remix/build-script.test.js +124 -0
- package/dist/test/remix/build-script.test.js.map +1 -0
- package/dist/test/remix/client-entry.test.js +4 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/run.test.d.ts +1 -0
- package/dist/test/run.test.js +137 -0
- package/dist/test/run.test.js.map +1 -0
- package/dist/test/sveltekit/templates.test.js +78 -27
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +101 -0
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/git.test.js +10 -0
- package/dist/test/utils/git.test.js.map +1 -1
- package/dist/test/utils/line-endings.test.d.ts +1 -0
- package/dist/test/utils/line-endings.test.js +103 -0
- package/dist/test/utils/line-endings.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/react-router/codemods/root.d.ts +0 -1
- package/dist/src/react-router/codemods/root.js +0 -170
- package/dist/src/react-router/codemods/root.js.map +0 -1
- package/dist/test/react-router/codemods/root.test.js +0 -182
- package/dist/test/react-router/codemods/root.test.js.map +0 -1
- /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-entry.test.js","sourceRoot":"","sources":["../../../../test/react-router/codemods/server-entry.test.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,+DAA+D;AAC/D,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,mCAAyE;AACzE,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AACjC,kFAIyD;AAEzD,kFAAkF;AAClF,uCAAkD;AAElD,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,GAAG,IAAI;KACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,KAAK,EAAE,WAAE,CAAC,EAAE,EAAE;CACf,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG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,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,2BAA2B,GAAG;;;;;;;CAOvC,CAAC;QAEE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAC;QAEvD,MAAM,IAAA,oCAAqB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE3C,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzD,MAAM,KAAK,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,4BAA4B,CAAC,IAAI,EAAE,CAAC;aACtE,MAAM,CAAC;QACV,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as recast from 'recast';\nimport {\n instrumentServerEntry,\n instrumentHandleRequest,\n instrumentHandleError,\n} from '../../../src/react-router/codemods/server-entry';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, generateCode } from 'magicast';\n\nvi.mock('@clack/prompts', () => {\n const mock = {\n log: {\n warn: vi.fn(),\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n return {\n default: mock,\n ...mock,\n };\n});\n\nvi.mock('../../../src/utils/debug', () => ({\n debug: vi.fn(),\n}));\n\ndescribe('instrumentServerEntry', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'server-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add Sentry import and wrap handleRequest function', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should add Sentry import\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n\n // Should wrap the existing handleRequest function\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should add the Sentry import at the top of the file (after existing imports)\n const lines = modifiedContent.split('\\n');\n const sentryImportLine = lines.findIndex((line) =>\n line.includes('import * as Sentry from \"@sentry/react-router\";'),\n );\n expect(sentryImportLine).toBeGreaterThanOrEqual(0);\n\n // Should make handleRequest async\n expect(modifiedContent).toMatch(/async function handleRequest/);\n\n // Should create default handleError since none exists\n expect(modifiedContent).toContain(\n 'export const handleError = Sentry.createSentryHandleError({',\n );\n expect(modifiedContent).toContain('logErrors: false');\n });\n\n it('should handle already instrumented server entry without duplication', async () => {\n const alreadyInstrumentedContent = fs.readFileSync(\n path.join(fixturesDir, 'already-instrumented.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, alreadyInstrumentedContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should not add duplicate imports or wrapping since already instrumented\n expect(modifiedContent).toContain(\n \"import * as Sentry from '@sentry/react-router';\",\n );\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should NOT add a new createSentryHandleError export since handleError already has captureException\n expect(modifiedContent).not.toContain(\n 'export const handleError = Sentry.createSentryHandleError({',\n );\n\n // Should preserve the existing handleError function with captureException\n expect(modifiedContent).toContain('Sentry.captureException(error);');\n expect(modifiedContent).toContain('export async function handleError');\n });\n\n it('should handle variable export pattern with existing export', async () => {\n const variableExportContent = fs.readFileSync(\n path.join(fixturesDir, 'variable-export.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, variableExportContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should add Sentry import and wrap handleRequest\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should instrument the existing handleError variable with captureException\n expect(modifiedContent).toContain('Sentry.captureException(error);');\n\n // Should preserve the variable export pattern\n expect(modifiedContent).toContain('export const handleError');\n });\n\n it('should not add duplicate async keyword when handleRequest is already async', async () => {\n const asyncContent = `\nimport { ServerRouter } from 'react-router';\nimport { renderToString } from 'react-dom/server';\n\nexport default async function handleRequest(request: Request) {\n const html = renderToString(<ServerRouter />);\n return new Response(html);\n}\n`;\n fs.writeFileSync(tmpFile, asyncContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should have async function handleRequest (not async async)\n expect(modifiedContent).toMatch(/async function handleRequest/);\n expect(modifiedContent).not.toMatch(/async\\s+async/);\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n });\n});\n\ndescribe('instrumentHandleRequest', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `handle-request-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add required imports when creating new handleRequest', async () => {\n const content = `// Empty server entry file`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n instrumentHandleRequest(mod);\n\n // Check if required imports were added\n const imports = mod.imports.$items;\n const hasServerRouter = imports.some(\n (item: any) =>\n item.imported === 'ServerRouter' && item.from === 'react-router',\n );\n const hasRenderToPipeableStream = imports.some(\n (item: any) =>\n item.imported === 'renderToPipeableStream' &&\n item.from === 'react-dom/server',\n );\n\n expect(hasServerRouter).toBe(true);\n expect(hasRenderToPipeableStream).toBe(true);\n });\n\n it('should not duplicate imports if they already exist', async () => {\n const content = `\nimport { ServerRouter } from 'react-router';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { createReadableStreamFromReadable } from '@react-router/node';\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n const originalImportsCount = mod.imports.$items.length;\n\n instrumentHandleRequest(mod);\n\n // Should not add duplicate imports\n expect(mod.imports.$items.length).toBe(originalImportsCount);\n });\n});\n\ndescribe('instrumentHandleError', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `handle-error-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should not modify existing handleError with captureException', async () => {\n const content = `\nexport function handleError(error: unknown) {\n Sentry.captureException(error);\n console.error(error);\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n const originalBodyLength = (mod.$ast as any).body.length;\n\n instrumentHandleError(mod);\n\n // Should not modify since captureException already exists\n expect((mod.$ast as any).body.length).toBe(originalBodyLength);\n });\n\n it('should not modify existing handleError with createSentryHandleError', async () => {\n const content = `\nexport const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const originalBodyLength = (mod.$ast as any).body.length;\n\n instrumentHandleError(mod);\n\n // Should not modify since createSentryHandleError already exists\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((mod.$ast as any).body.length).toBe(originalBodyLength);\n });\n\n it('should add captureException to existing handleError function declaration without breaking AST', async () => {\n const content = `\nexport function handleError(error: unknown) {\n console.error('Custom error handling:', error);\n // some other logic here\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function was modified correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain(\n \"console.error('Custom error handling:', error)\",\n );\n });\n\n it('should add captureException to existing handleError variable declaration without breaking AST', async () => {\n const content = `\nexport const handleError = (error: unknown, { request }: { request: Request }) => {\n console.log('Handling error:', error.message);\n return new Response('Error occurred', { status: 500 });\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function was modified correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain(\n \"console.log('Handling error:', error.message)\",\n );\n });\n\n it('should handle existing handleError with only error parameter and add request parameter', async () => {\n const content = `\nexport const handleError = (error: unknown) => {\n console.error('Simple error handler:', error);\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function signature was updated correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n // Should add request parameter\n expect(modifiedCode).toMatch(\n /handleError.*=.*\\(\\s*error.*,\\s*\\{\\s*request\\s*\\}/,\n );\n });\n});\n\ndescribe('instrumentHandleError AST manipulation edge cases', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `ast-edge-cases-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should handle function declaration with existing try-catch block', async () => {\n const content = `\nexport function handleError(error: unknown, { request }: { request: Request }) {\n try {\n console.error('Error occurred:', error);\n logToExternalService(error);\n } catch (loggingError) {\n console.warn('Failed to log error:', loggingError);\n }\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test will expose the broken AST logic\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n // Should preserve existing try-catch\n expect(modifiedCode).toContain('try {');\n expect(modifiedCode).toContain('} catch (loggingError) {');\n });\n\n it('should handle arrow function with block body', async () => {\n const content = `\nexport const handleError = (error: unknown, context: any) => {\n const { request } = context;\n console.error('Error in route:', error);\n return new Response('Internal Server Error', { status: 500 });\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test will expose the broken AST logic\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n });\n\n it('should demonstrate that the AST bug is now fixed - no longer throws TypeError', async () => {\n const content = `\nexport function handleError(error: unknown) {\n console.error('Error occurred:', error);\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test specifically targets the broken AST logic at lines 279-284 in server-entry.ts\n // The bug is in this code:\n // implementation.declarations[0].init.arguments[0].body.body.unshift(...)\n // Where 'implementation' is an IfStatement, not a VariableDeclaration\n\n let thrownError: Error | null = null;\n try {\n instrumentHandleError(mod);\n } catch (error) {\n thrownError = error as Error;\n }\n\n // The bug is fixed - no error should be thrown\n expect(thrownError).toBeNull();\n\n // And the code should be successfully modified\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n\n // The error occurs because recast.parse() creates an IfStatement:\n // { type: 'IfStatement', test: ..., consequent: ... }\n // But the code tries to access .declarations[0] as if it were a VariableDeclaration\n });\n\n it('should demonstrate the specific line that breaks - recast.parse creates IfStatement not VariableDeclaration', () => {\n // This test shows exactly what the problematic line 278 in server-entry.ts creates\n const problematicCode = `if (!request.signal.aborted) {\n Sentry.captureException(error);\n}`;\n\n // This is what line 278 does: recast.parse(problematicCode).program.body[0]\n const implementation = recast.parse(problematicCode).program.body[0];\n\n // The implementation is an IfStatement, not a VariableDeclaration\n expect(implementation.type).toBe('IfStatement');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion\n expect((implementation as any).declarations).toBeUndefined();\n\n // But lines 279-284 try to access implementation.declarations[0].init.arguments[0].body.body\n // This will throw \"Cannot read properties of undefined (reading '0')\"\n expect(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unnecessary-type-assertion\n const declarations = (implementation as any).declarations;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return declarations[0]; // This line will throw the error\n }).toThrow('Cannot read properties of undefined');\n });\n});\n\n// Test for Bug #1: Array access vulnerability\ndescribe('Array access vulnerability bugs', () => {\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n }\n });\n\n it('should safely handle VariableDeclaration with empty declarations array', () => {\n // This test verifies that the bug fix works correctly\n // Previously this would crash, but now it handles empty arrays safely\n\n // The implementation now includes proper safety checks, so we test that\n // it can handle edge cases without crashing\n\n // Test the actual safe implementation behavior\n const testResult = () => {\n // Simulate the safe check logic from the actual implementation\n const declarations: any[] = []; // Empty array\n if (!declarations || declarations.length === 0) {\n return false; // Safe early return\n }\n // This code would never be reached due to the safe check\n return declarations[0].id.name === 'handleError';\n };\n\n // Should return false safely without throwing\n expect(testResult()).toBe(false);\n });\n\n it('should safely handle VariableDeclaration with empty declarations array after fix', async () => {\n // This test will pass after we fix the bug\n\n fs.writeFileSync(tmpFile, 'export const handleError = () => {};');\n const mod = await loadFile(tmpFile);\n\n // Create a problematic AST structure\n const problematicNode = {\n type: 'ExportNamedDeclaration',\n declaration: {\n type: 'VariableDeclaration',\n kind: 'const',\n declarations: [], // Empty declarations array\n },\n };\n\n // Add the problematic node to the AST\n // @ts-expect-error - We need to access body for this test even though it's typed as any\n (mod.$ast.body as any[]).push(problematicNode);\n\n // After the fix, this should NOT throw an error\n let thrownError = null;\n try {\n instrumentHandleError(mod);\n } catch (error) {\n thrownError = error;\n }\n\n // After the fix, no error should be thrown\n expect(thrownError).toBeNull();\n });\n});\n\ndescribe('Instrumentation API', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'server-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-instrumentation-api-${Date.now()}-${Math.random()\n .toString(36)\n .substring(2, 11)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add unstable_instrumentations export when useInstrumentationAPI is true', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain(\n 'export const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];',\n );\n });\n\n it('should not add unstable_instrumentations export when useInstrumentationAPI is false', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).not.toContain('unstable_instrumentations');\n expect(modifiedContent).not.toContain('createSentryServerInstrumentation');\n });\n\n it('should not duplicate unstable_instrumentations export if already present', async () => {\n const contentWithInstrumentations = `\nimport { ServerRouter } from 'react-router';\nimport * as Sentry from '@sentry/react-router';\n\nexport default function handleRequest() {}\nexport const handleError = () => {};\nexport const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];\n`;\n\n fs.writeFileSync(tmpFile, contentWithInstrumentations);\n\n await instrumentServerEntry(tmpFile, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n const count = (modifiedContent.match(/unstable_instrumentations/g) || [])\n .length;\n expect(count).toBe(1);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"server-entry.test.js","sourceRoot":"","sources":["../../../../test/react-router/codemods/server-entry.test.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,+DAA+D;AAC/D,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,mCAAyE;AACzE,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AACjC,kFAIyD;AAEzD,kFAAkF;AAClF,uCAAkD;AAElD,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,GAAG,IAAI;KACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,KAAK,EAAE,WAAE,CAAC,EAAE,EAAE;CACf,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,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C;IAEH,IAAA,WAAE,EAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,2BAA2B,GAAG;;;;;;;CAOvC,CAAC;QAEE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAC;QAEvD,MAAM,IAAA,oCAAqB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE3C,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzD,MAAM,KAAK,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QAC5E,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,oFAAoF,EAAE,KAAK,IAAI,EAAE;QAClG,MAAM,iBAAiB,GAAG;;;;;;;CAO7B,CAAC;QAEE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAE7C,MAAM,IAAA,oCAAqB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE3C,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as recast from 'recast';\nimport {\n instrumentServerEntry,\n instrumentHandleRequest,\n instrumentHandleError,\n} from '../../../src/react-router/codemods/server-entry';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, generateCode } from 'magicast';\n\nvi.mock('@clack/prompts', () => {\n const mock = {\n log: {\n warn: vi.fn(),\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n return {\n default: mock,\n ...mock,\n };\n});\n\nvi.mock('../../../src/utils/debug', () => ({\n debug: vi.fn(),\n}));\n\ndescribe('instrumentServerEntry', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'server-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add Sentry import and wrap handleRequest function', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should add Sentry import\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n\n // Should wrap the existing handleRequest function\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should add the Sentry import at the top of the file (after existing imports)\n const lines = modifiedContent.split('\\n');\n const sentryImportLine = lines.findIndex((line) =>\n line.includes('import * as Sentry from \"@sentry/react-router\";'),\n );\n expect(sentryImportLine).toBeGreaterThanOrEqual(0);\n\n // Should make handleRequest async\n expect(modifiedContent).toMatch(/async function handleRequest/);\n\n // Should create default handleError since none exists\n expect(modifiedContent).toContain(\n 'export const handleError = Sentry.createSentryHandleError({',\n );\n expect(modifiedContent).toContain('logErrors: false');\n });\n\n it('should handle already instrumented server entry without duplication', async () => {\n const alreadyInstrumentedContent = fs.readFileSync(\n path.join(fixturesDir, 'already-instrumented.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, alreadyInstrumentedContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should not add duplicate imports or wrapping since already instrumented\n expect(modifiedContent).toContain(\n \"import * as Sentry from '@sentry/react-router';\",\n );\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should NOT add a new createSentryHandleError export since handleError already has captureException\n expect(modifiedContent).not.toContain(\n 'export const handleError = Sentry.createSentryHandleError({',\n );\n\n // Should preserve the existing handleError function with captureException\n expect(modifiedContent).toContain('Sentry.captureException(error);');\n expect(modifiedContent).toContain('export async function handleError');\n });\n\n it('should handle variable export pattern with existing export', async () => {\n const variableExportContent = fs.readFileSync(\n path.join(fixturesDir, 'variable-export.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, variableExportContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should add Sentry import and wrap handleRequest\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n\n // Should instrument the existing handleError variable with captureException\n expect(modifiedContent).toContain('Sentry.captureException(error);');\n\n // Should preserve the variable export pattern\n expect(modifiedContent).toContain('export const handleError');\n });\n\n it('should not add duplicate async keyword when handleRequest is already async', async () => {\n const asyncContent = `\nimport { ServerRouter } from 'react-router';\nimport { renderToString } from 'react-dom/server';\n\nexport default async function handleRequest(request: Request) {\n const html = renderToString(<ServerRouter />);\n return new Response(html);\n}\n`;\n fs.writeFileSync(tmpFile, asyncContent);\n\n await instrumentServerEntry(tmpFile);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should have async function handleRequest (not async async)\n expect(modifiedContent).toMatch(/async function handleRequest/);\n expect(modifiedContent).not.toMatch(/async\\s+async/);\n expect(modifiedContent).toContain(\n 'export default Sentry.wrapSentryHandleRequest(handleRequest);',\n );\n });\n});\n\ndescribe('instrumentHandleRequest', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `handle-request-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add required imports when creating new handleRequest', async () => {\n const content = `// Empty server entry file`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n instrumentHandleRequest(mod);\n\n // Check if required imports were added\n const imports = mod.imports.$items;\n const hasServerRouter = imports.some(\n (item: any) =>\n item.imported === 'ServerRouter' && item.from === 'react-router',\n );\n const hasRenderToPipeableStream = imports.some(\n (item: any) =>\n item.imported === 'renderToPipeableStream' &&\n item.from === 'react-dom/server',\n );\n\n expect(hasServerRouter).toBe(true);\n expect(hasRenderToPipeableStream).toBe(true);\n });\n\n it('should not duplicate imports if they already exist', async () => {\n const content = `\nimport { ServerRouter } from 'react-router';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { createReadableStreamFromReadable } from '@react-router/node';\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n const originalImportsCount = mod.imports.$items.length;\n\n instrumentHandleRequest(mod);\n\n // Should not add duplicate imports\n expect(mod.imports.$items.length).toBe(originalImportsCount);\n });\n});\n\ndescribe('instrumentHandleError', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `handle-error-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should not modify existing handleError with captureException', async () => {\n const content = `\nexport function handleError(error: unknown) {\n Sentry.captureException(error);\n console.error(error);\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n const originalBodyLength = (mod.$ast as any).body.length;\n\n instrumentHandleError(mod);\n\n // Should not modify since captureException already exists\n expect((mod.$ast as any).body.length).toBe(originalBodyLength);\n });\n\n it('should not modify existing handleError with createSentryHandleError', async () => {\n const content = `\nexport const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const originalBodyLength = (mod.$ast as any).body.length;\n\n instrumentHandleError(mod);\n\n // Should not modify since createSentryHandleError already exists\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((mod.$ast as any).body.length).toBe(originalBodyLength);\n });\n\n it('should add captureException to existing handleError function declaration without breaking AST', async () => {\n const content = `\nexport function handleError(error: unknown) {\n console.error('Custom error handling:', error);\n // some other logic here\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function was modified correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain(\n \"console.error('Custom error handling:', error)\",\n );\n });\n\n it('should add captureException to existing handleError variable declaration without breaking AST', async () => {\n const content = `\nexport const handleError = (error: unknown, { request }: { request: Request }) => {\n console.log('Handling error:', error.message);\n return new Response('Error occurred', { status: 500 });\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function was modified correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain(\n \"console.log('Handling error:', error.message)\",\n );\n });\n\n it('should handle existing handleError with only error parameter and add request parameter', async () => {\n const content = `\nexport const handleError = (error: unknown) => {\n console.error('Simple error handler:', error);\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This should not throw an error due to broken AST manipulation\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n // Verify the function signature was updated correctly\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n // Should add request parameter\n expect(modifiedCode).toMatch(\n /handleError.*=.*\\(\\s*error.*,\\s*\\{\\s*request\\s*\\}/,\n );\n });\n});\n\ndescribe('instrumentHandleError AST manipulation edge cases', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `ast-edge-cases-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should handle function declaration with existing try-catch block', async () => {\n const content = `\nexport function handleError(error: unknown, { request }: { request: Request }) {\n try {\n console.error('Error occurred:', error);\n logToExternalService(error);\n } catch (loggingError) {\n console.warn('Failed to log error:', loggingError);\n }\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test will expose the broken AST logic\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n // Should preserve existing try-catch\n expect(modifiedCode).toContain('try {');\n expect(modifiedCode).toContain('} catch (loggingError) {');\n });\n\n it('should handle arrow function with block body', async () => {\n const content = `\nexport const handleError = (error: unknown, context: any) => {\n const { request } = context;\n console.error('Error in route:', error);\n return new Response('Internal Server Error', { status: 500 });\n};\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test will expose the broken AST logic\n expect(() => instrumentHandleError(mod)).not.toThrow();\n\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n expect(modifiedCode).toContain('if (!request.signal.aborted)');\n });\n\n it('should demonstrate that the AST bug is now fixed - no longer throws TypeError', async () => {\n const content = `\nexport function handleError(error: unknown) {\n console.error('Error occurred:', error);\n}\n`;\n const tempFile = path.join(tmpDir, 'entry.server.tsx');\n fs.writeFileSync(tempFile, content);\n\n const mod = await loadFile(tempFile);\n\n // This test specifically targets the broken AST logic at lines 279-284 in server-entry.ts\n // The bug is in this code:\n // implementation.declarations[0].init.arguments[0].body.body.unshift(...)\n // Where 'implementation' is an IfStatement, not a VariableDeclaration\n\n let thrownError: Error | null = null;\n try {\n instrumentHandleError(mod);\n } catch (error) {\n thrownError = error as Error;\n }\n\n // The bug is fixed - no error should be thrown\n expect(thrownError).toBeNull();\n\n // And the code should be successfully modified\n const modifiedCode = generateCode(mod.$ast).code;\n expect(modifiedCode).toContain('Sentry.captureException(error)');\n\n // The error occurs because recast.parse() creates an IfStatement:\n // { type: 'IfStatement', test: ..., consequent: ... }\n // But the code tries to access .declarations[0] as if it were a VariableDeclaration\n });\n\n it('should demonstrate the specific line that breaks - recast.parse creates IfStatement not VariableDeclaration', () => {\n // This test shows exactly what the problematic line 278 in server-entry.ts creates\n const problematicCode = `if (!request.signal.aborted) {\n Sentry.captureException(error);\n}`;\n\n // This is what line 278 does: recast.parse(problematicCode).program.body[0]\n const implementation = recast.parse(problematicCode).program.body[0];\n\n // The implementation is an IfStatement, not a VariableDeclaration\n expect(implementation.type).toBe('IfStatement');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion\n expect((implementation as any).declarations).toBeUndefined();\n\n // But lines 279-284 try to access implementation.declarations[0].init.arguments[0].body.body\n // This will throw \"Cannot read properties of undefined (reading '0')\"\n expect(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unnecessary-type-assertion\n const declarations = (implementation as any).declarations;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return declarations[0]; // This line will throw the error\n }).toThrow('Cannot read properties of undefined');\n });\n});\n\n// Test for Bug #1: Array access vulnerability\ndescribe('Array access vulnerability bugs', () => {\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n }\n });\n\n it('should safely handle VariableDeclaration with empty declarations array', () => {\n // This test verifies that the bug fix works correctly\n // Previously this would crash, but now it handles empty arrays safely\n\n // The implementation now includes proper safety checks, so we test that\n // it can handle edge cases without crashing\n\n // Test the actual safe implementation behavior\n const testResult = () => {\n // Simulate the safe check logic from the actual implementation\n const declarations: any[] = []; // Empty array\n if (!declarations || declarations.length === 0) {\n return false; // Safe early return\n }\n // This code would never be reached due to the safe check\n return declarations[0].id.name === 'handleError';\n };\n\n // Should return false safely without throwing\n expect(testResult()).toBe(false);\n });\n\n it('should safely handle VariableDeclaration with empty declarations array after fix', async () => {\n // This test will pass after we fix the bug\n\n fs.writeFileSync(tmpFile, 'export const handleError = () => {};');\n const mod = await loadFile(tmpFile);\n\n // Create a problematic AST structure\n const problematicNode = {\n type: 'ExportNamedDeclaration',\n declaration: {\n type: 'VariableDeclaration',\n kind: 'const',\n declarations: [], // Empty declarations array\n },\n };\n\n // Add the problematic node to the AST\n // @ts-expect-error - We need to access body for this test even though it's typed as any\n (mod.$ast.body as any[]).push(problematicNode);\n\n // After the fix, this should NOT throw an error\n let thrownError = null;\n try {\n instrumentHandleError(mod);\n } catch (error) {\n thrownError = error;\n }\n\n // After the fix, no error should be thrown\n expect(thrownError).toBeNull();\n });\n});\n\ndescribe('Instrumentation API', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'server-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n tmpDir = path.join(\n __dirname,\n 'fixtures',\n 'tmp',\n `test-instrumentation-api-${Date.now()}-${Math.random()\n .toString(36)\n .substring(2, 11)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.server.tsx');\n\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add instrumentations export when useInstrumentationAPI is true', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain(\n 'export const instrumentations = [Sentry.createSentryServerInstrumentation()];',\n );\n });\n\n it('should not add instrumentations export when useInstrumentationAPI is false', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentServerEntry(tmpFile, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).not.toContain('instrumentations');\n expect(modifiedContent).not.toContain('createSentryServerInstrumentation');\n });\n\n it('should not duplicate instrumentations export if already present', async () => {\n const contentWithInstrumentations = `\nimport { ServerRouter } from 'react-router';\nimport * as Sentry from '@sentry/react-router';\n\nexport default function handleRequest() {}\nexport const handleError = () => {};\nexport const instrumentations = [Sentry.createSentryServerInstrumentation()];\n`;\n\n fs.writeFileSync(tmpFile, contentWithInstrumentations);\n\n await instrumentServerEntry(tmpFile, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n const count = (modifiedContent.match(/\\binstrumentations\\b/g) || []).length;\n expect(count).toBe(1);\n });\n\n it('should not duplicate if legacy unstable_instrumentations export is already present', async () => {\n const contentWithLegacy = `\nimport { ServerRouter } from 'react-router';\nimport * as Sentry from '@sentry/react-router';\n\nexport default function handleRequest() {}\nexport const handleError = () => {};\nexport const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];\n`;\n\n fs.writeFileSync(tmpFile, contentWithLegacy);\n\n await instrumentServerEntry(tmpFile, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).not.toContain('export const instrumentations =');\n });\n});\n"]}
|
|
@@ -146,32 +146,32 @@ const templates_1 = require("../../src/react-router/templates");
|
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
148
|
(0, vitest_1.describe)('supportsInstrumentationAPI', () => {
|
|
149
|
-
(0, vitest_1.it)('should return true for React Router v7.
|
|
149
|
+
(0, vitest_1.it)('should return true for React Router v7.15.0 or higher', () => {
|
|
150
150
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
151
|
-
dependencies: { '@react-router/dev': '7.
|
|
151
|
+
dependencies: { '@react-router/dev': '7.15.0' },
|
|
152
152
|
})).toBe(true);
|
|
153
153
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
154
|
-
dependencies: { '@react-router/dev': '^7.
|
|
154
|
+
dependencies: { '@react-router/dev': '^7.15.0' },
|
|
155
155
|
})).toBe(true);
|
|
156
156
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
157
|
-
dependencies: { '@react-router/dev': '7.
|
|
157
|
+
dependencies: { '@react-router/dev': '7.16.0' },
|
|
158
158
|
})).toBe(true);
|
|
159
159
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
160
160
|
dependencies: { '@react-router/dev': '8.0.0' },
|
|
161
161
|
})).toBe(true);
|
|
162
162
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
163
|
-
devDependencies: { '@react-router/dev': '7.
|
|
163
|
+
devDependencies: { '@react-router/dev': '7.15.0' },
|
|
164
164
|
})).toBe(true);
|
|
165
165
|
});
|
|
166
|
-
(0, vitest_1.it)('should return false for React Router versions below v7.
|
|
166
|
+
(0, vitest_1.it)('should return false for React Router versions below v7.15.0', () => {
|
|
167
167
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
168
|
-
dependencies: { '@react-router/dev': '7.
|
|
168
|
+
dependencies: { '@react-router/dev': '7.14.0' },
|
|
169
169
|
})).toBe(false);
|
|
170
170
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
171
171
|
dependencies: { '@react-router/dev': '7.0.0' },
|
|
172
172
|
})).toBe(false);
|
|
173
173
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
174
|
-
dependencies: { '@react-router/dev': '7.9.
|
|
174
|
+
dependencies: { '@react-router/dev': '7.9.5' },
|
|
175
175
|
})).toBe(false);
|
|
176
176
|
});
|
|
177
177
|
(0, vitest_1.it)('should return false when @react-router/dev is not installed', () => {
|
|
@@ -182,12 +182,48 @@ const templates_1 = require("../../src/react-router/templates");
|
|
|
182
182
|
});
|
|
183
183
|
(0, vitest_1.it)('should handle semver range specifiers correctly', () => {
|
|
184
184
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
185
|
-
dependencies: { '@react-router/dev': '~7.
|
|
185
|
+
dependencies: { '@react-router/dev': '~7.15.0' },
|
|
186
186
|
})).toBe(true);
|
|
187
187
|
(0, vitest_1.expect)((0, sdk_setup_1.supportsInstrumentationAPI)({
|
|
188
|
-
dependencies: { '@react-router/dev': '>=7.
|
|
188
|
+
dependencies: { '@react-router/dev': '>=7.15.0' },
|
|
189
|
+
})).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
(0, vitest_1.describe)('supportsOnError', () => {
|
|
193
|
+
(0, vitest_1.it)('should return true for React Router v7.11.0 or higher', () => {
|
|
194
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
195
|
+
dependencies: { '@react-router/dev': '7.11.0' },
|
|
196
|
+
})).toBe(true);
|
|
197
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
198
|
+
dependencies: { '@react-router/dev': '^7.11.0' },
|
|
199
|
+
})).toBe(true);
|
|
200
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
201
|
+
dependencies: { '@react-router/dev': '7.12.0' },
|
|
202
|
+
})).toBe(true);
|
|
203
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
204
|
+
dependencies: { '@react-router/dev': '8.0.0' },
|
|
205
|
+
})).toBe(true);
|
|
206
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
207
|
+
devDependencies: { '@react-router/dev': '7.11.0' },
|
|
189
208
|
})).toBe(true);
|
|
190
209
|
});
|
|
210
|
+
(0, vitest_1.it)('should return false for React Router versions below v7.11.0', () => {
|
|
211
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
212
|
+
dependencies: { '@react-router/dev': '7.10.0' },
|
|
213
|
+
})).toBe(false);
|
|
214
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
215
|
+
dependencies: { '@react-router/dev': '7.0.0' },
|
|
216
|
+
})).toBe(false);
|
|
217
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
218
|
+
dependencies: { '@react-router/dev': '7.8.2' },
|
|
219
|
+
})).toBe(false);
|
|
220
|
+
});
|
|
221
|
+
(0, vitest_1.it)('should return false when @react-router/dev is not installed', () => {
|
|
222
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({
|
|
223
|
+
dependencies: { react: '^18.0.0' },
|
|
224
|
+
})).toBe(false);
|
|
225
|
+
(0, vitest_1.expect)((0, sdk_setup_1.supportsOnError)({})).toBe(false);
|
|
226
|
+
});
|
|
191
227
|
});
|
|
192
228
|
(0, vitest_1.describe)('generateServerInstrumentation', () => {
|
|
193
229
|
(0, vitest_1.it)('should generate server instrumentation file with all features enabled', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.test.js","sourceRoot":"","sources":["../../../test/react-router/sdk-setup.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8D;AAE9D,MAAM,EAAE,UAAU,EAAE,GAAG,WAAE,CAAC,OAAO,CAAC,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACrB,MAAM,IAAI,GAAG,WAAE,CAAC,EAAE,EAAE,C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AAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAW,CACJ,CAAC;QAEzC,0DAA0D;QAC1D,IAAA,eAAM,EAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CACvC,6IAA6I,CAC9I,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;QAClF,MAAM,eAAe,GAAwC;YAC3D,OAAO,EAAE;gBACP,GAAG,EAAE,2DAA2D;gBAChE,KAAK,EAAE,wDAAwD;aAChE;SACF,CAAC;QAEF,qBAAqB,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAEzD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,aAAa,GAAG,WAAE;aACrB,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC;aACvC,iBAAiB,EAAE,CAAC;QAEvB,MAAM,IAAA,oCAAwB,GAAE,CAAC;QAEjC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAC/B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAW,CACJ,CAAC;QAEzC,sCAAsC;QACtC,IAAA,eAAM,EAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACrC,4FAA4F,CAC7F,CAAC;QACF,qDAAqD;QACrD,IAAA,eAAM,EAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CACvC,6GAA6G,CAC9G,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach } from 'vitest';\n\nconst { clackMocks } = vi.hoisted(() => {\n const info = vi.fn();\n const warn = vi.fn();\n const error = vi.fn();\n const success = vi.fn();\n const outro = vi.fn();\n const confirm = vi.fn(() => Promise.resolve(false)); // default to false for tests\n\n return {\n clackMocks: {\n info,\n warn,\n error,\n success,\n outro,\n confirm,\n },\n };\n});\n\nvi.mock('@clack/prompts', () => {\n return {\n __esModule: true,\n default: {\n log: {\n info: clackMocks.info,\n warn: clackMocks.warn,\n error: clackMocks.error,\n success: clackMocks.success,\n },\n outro: clackMocks.outro,\n confirm: clackMocks.confirm,\n },\n };\n});\n\nconst { existsSyncMock, readFileSyncMock, writeFileSyncMock } = vi.hoisted(\n () => {\n return {\n existsSyncMock: vi.fn(),\n readFileSyncMock: vi.fn(),\n writeFileSyncMock: vi.fn(),\n };\n },\n);\n\nconst { getPackageDotJsonMock, getPackageVersionMock } = vi.hoisted(() => ({\n getPackageDotJsonMock: vi.fn(),\n getPackageVersionMock: vi.fn(),\n}));\n\nvi.mock('../../src/utils/package-json', () => ({\n getPackageDotJson: getPackageDotJsonMock,\n getPackageVersion: getPackageVersionMock,\n}));\n\nvi.mock('fs', async () => {\n return {\n ...(await vi.importActual('fs')),\n existsSync: existsSyncMock,\n readFileSync: readFileSyncMock,\n writeFileSync: writeFileSyncMock,\n promises: {\n writeFile: vi.fn(),\n },\n };\n});\n\n// module-level mock for child_process.execSync\nvi.mock('child_process', () => ({\n __esModule: true,\n execSync: vi.fn(),\n}));\n\n// mock showCopyPasteInstructions and makeCodeSnippet used by templates\nvi.mock('../../src/utils/clack', () => {\n return {\n __esModule: true,\n showCopyPasteInstructions: vi.fn(() => Promise.resolve()),\n makeCodeSnippet: vi.fn(\n (\n colors: boolean,\n callback: (\n unchanged: (str: string) => string,\n plus: (str: string) => string,\n minus: (str: string) => string,\n ) => string,\n ) => {\n // Mock implementation that just calls the callback with simple string functions\n const unchanged = (str: string) => str;\n const plus = (str: string) => `+ ${str}`;\n const minus = (str: string) => `- ${str}`;\n return callback(unchanged, plus, minus);\n },\n ),\n getPackageDotJson: getPackageDotJsonMock,\n };\n});\n\nimport {\n isReactRouterV7,\n getReactRouterVersion,\n supportsInstrumentationAPI,\n runReactRouterReveal,\n createServerInstrumentationFile,\n tryRevealAndGetManualInstructions,\n updatePackageJsonScripts,\n} from '../../src/react-router/sdk-setup';\nimport * as childProcess from 'child_process';\nimport type { Mock } from 'vitest';\nimport { getSentryInstrumentationServerContent } from '../../src/react-router/templates';\n\ndescribe('React Router SDK Setup', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n\n getPackageVersionMock.mockImplementation(\n (\n packageName: string,\n packageJson: {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n },\n ) => {\n if (packageJson.dependencies?.[packageName]) {\n return packageJson.dependencies[packageName];\n }\n if (packageJson.devDependencies?.[packageName]) {\n return packageJson.devDependencies[packageName];\n }\n return null;\n },\n );\n });\n\n describe('isReactRouterV7', () => {\n it('should return true for React Router v7+ in dependencies or devDependencies', () => {\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '7.0.0' } }),\n ).toBe(true);\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '^7.1.0' } }),\n ).toBe(true);\n expect(\n isReactRouterV7({\n devDependencies: { '@react-router/dev': '7.1.0' },\n }),\n ).toBe(true);\n });\n\n it('should return false for React Router v6 or missing dependency', () => {\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '6.28.0' } }),\n ).toBe(false);\n expect(isReactRouterV7({ dependencies: { react: '^18.0.0' } })).toBe(\n false,\n );\n expect(isReactRouterV7({})).toBe(false);\n });\n });\n\n describe('getReactRouterVersion', () => {\n it('should coerce range version from package.json', () => {\n expect(\n getReactRouterVersion({\n dependencies: { '@react-router/dev': '^7.8.2' },\n }),\n ).toBe('7.8.2');\n });\n\n it('should return undefined when package is not in package.json', () => {\n expect(\n getReactRouterVersion({ dependencies: { react: '^18.0.0' } }),\n ).toBeUndefined();\n expect(getReactRouterVersion({})).toBeUndefined();\n });\n });\n\n describe('supportsInstrumentationAPI', () => {\n it('should return true for React Router v7.9.5 or higher', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.9.5' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '^7.9.5' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.10.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '8.0.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n devDependencies: { '@react-router/dev': '7.9.5' },\n }),\n ).toBe(true);\n });\n\n it('should return false for React Router versions below v7.9.5', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.9.4' },\n }),\n ).toBe(false);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.0.0' },\n }),\n ).toBe(false);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.9.0' },\n }),\n ).toBe(false);\n });\n\n it('should return false when @react-router/dev is not installed', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { react: '^18.0.0' },\n }),\n ).toBe(false);\n expect(supportsInstrumentationAPI({})).toBe(false);\n });\n\n it('should handle semver range specifiers correctly', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '~7.9.5' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '>=7.9.5' },\n }),\n ).toBe(true);\n });\n });\n\n describe('generateServerInstrumentation', () => {\n it('should generate server instrumentation file with all features enabled', () => {\n const dsn = 'https://sentry.io/123';\n const enableTracing = true;\n const enableProfiling = false;\n const enableLogs = true;\n\n const result = getSentryInstrumentationServerContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain('dsn: \"https://sentry.io/123\"');\n expect(result).toContain('tracesSampleRate: 1');\n expect(result).toContain('enableLogs: true');\n });\n\n it('should generate server instrumentation file when performance is disabled', () => {\n const dsn = 'https://sentry.io/123';\n const enableTracing = false;\n const enableProfiling = false;\n const enableLogs = false;\n\n const result = getSentryInstrumentationServerContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain('dsn: \"https://sentry.io/123\"');\n expect(result).toContain('tracesSampleRate: 0');\n expect(result).not.toContain('enableLogs: true');\n });\n });\n});\n\ndescribe('runReactRouterReveal', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('runs the reveal CLI when entry files are missing', () => {\n existsSyncMock.mockReturnValue(false);\n\n (childProcess.execSync as unknown as Mock).mockImplementation(() => 'ok');\n\n runReactRouterReveal();\n\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n });\n\n it('does not run the reveal CLI when entry files already exist', () => {\n existsSyncMock.mockReturnValue(true);\n\n (childProcess.execSync as unknown as Mock).mockReset();\n\n runReactRouterReveal();\n\n expect(childProcess.execSync).not.toHaveBeenCalled();\n });\n});\n\ndescribe('server instrumentation helpers', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('createServerInstrumentationFile writes instrumentation file and returns path', () => {\n writeFileSyncMock.mockImplementation(() => undefined);\n\n const path = createServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: true,\n profiling: false,\n });\n\n expect(path).toContain('instrument.server.mjs');\n expect(writeFileSyncMock).toHaveBeenCalled();\n const writtenCall = writeFileSyncMock.mock.calls[0] as unknown as [\n string,\n string,\n ];\n expect(writtenCall[0]).toEqual(\n expect.stringContaining('instrument.server.mjs'),\n );\n expect(writtenCall[1]).toEqual(\n expect.stringContaining('dsn: \"https://sentry.io/123\"'),\n );\n expect(writtenCall[1]).toEqual(\n expect.stringContaining('tracesSampleRate: 1'),\n );\n });\n});\n\ndescribe('tryRevealAndGetManualInstructions', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('should return true when user confirms and reveal command succeeds', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n 'Successfully generated entry files',\n );\n\n // Mock file existing after reveal\n existsSyncMock.mockReturnValueOnce(true);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(true);\n expect(clackMocks.confirm).toHaveBeenCalledWith({\n message: expect.stringContaining(\n 'Would you like to try running',\n ) as string,\n initialValue: true,\n });\n expect(clackMocks.info).toHaveBeenCalledWith(\n expect.stringContaining('Running'),\n );\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n expect(clackMocks.success).toHaveBeenCalledWith(\n expect.stringContaining('Found entry.client.tsx after running reveal'),\n );\n });\n\n it('should return false when user declines reveal operation', async () => {\n const missingFilename = 'entry.server.tsx';\n const filePath = '/app/entry.server.tsx';\n\n // Mock user declining the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(false);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(clackMocks.confirm).toHaveBeenCalled();\n expect(childProcess.execSync).not.toHaveBeenCalled();\n expect(clackMocks.info).not.toHaveBeenCalled();\n });\n\n it('should return false when reveal command succeeds but file still does not exist', async () => {\n const missingFilename = 'entry.client.jsx';\n const filePath = '/app/entry.client.jsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n 'Command output',\n );\n\n // Mock file NOT existing after reveal\n existsSyncMock.mockReturnValueOnce(false);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(childProcess.execSync).toHaveBeenCalled();\n expect(clackMocks.warn).toHaveBeenCalledWith(\n expect.stringContaining(\n 'entry.client.jsx still not found after running reveal',\n ),\n );\n });\n\n it('should return false when reveal command throws an error', async () => {\n const missingFilename = 'entry.server.jsx';\n const filePath = '/app/entry.server.jsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync throwing an error\n const mockError = new Error('Command failed');\n (childProcess.execSync as unknown as Mock).mockImplementationOnce(() => {\n throw mockError;\n });\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(childProcess.execSync).toHaveBeenCalled();\n expect(clackMocks.warn).toHaveBeenCalledWith(\n expect.stringContaining('Failed to run npx react-router reveal'),\n );\n });\n\n it('should log command output when reveal succeeds', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n const commandOutput = 'Generated entry files successfully';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding with output\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n commandOutput,\n );\n\n // Mock file existing after reveal\n existsSyncMock.mockReturnValueOnce(true);\n\n await tryRevealAndGetManualInstructions(missingFilename, filePath);\n\n expect(clackMocks.info).toHaveBeenCalledWith(commandOutput);\n });\n\n it('should handle reveal command with proper parameters', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n\n // Mock user confirming\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce('ok');\n\n // Mock file existing\n existsSyncMock.mockReturnValueOnce(true);\n\n await tryRevealAndGetManualInstructions(missingFilename, filePath);\n\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n });\n});\n\ndescribe('updatePackageJsonScripts', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('should set NODE_ENV=production for both dev and start scripts (workaround for React Router v7 + React 19 issue)', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'react-router dev',\n start: 'react-router serve',\n build: 'react-router build',\n },\n };\n\n // Mock getPackageDotJson to return our test package.json\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n // Mock fs.promises.writeFile\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n // Verify writeFile was called\n expect(writeFileMock).toHaveBeenCalled();\n\n // Check the written package.json content\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Both dev and start scripts should use the correct filenames and commands according to documentation\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--import ./instrument.server.mjs' react-router dev\",\n );\n\n // Start script should have NODE_ENV=production before --import\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n\n // The build script should remain unchanged\n expect(writtenContent.scripts.build).toBe('react-router build');\n });\n\n it('should handle package.json with only start script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n start: 'react-router serve',\n },\n };\n\n // Mock getPackageDotJson to return our test package.json\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n // Mock fs.promises.writeFile\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n // Verify only start script is modified when dev doesn't exist\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n expect(writtenContent.scripts.dev).toBeUndefined();\n });\n\n it('should throw error when no start script exists', async () => {\n const mockPackageJson = {\n scripts: {\n build: 'react-router build',\n },\n };\n\n // Mock getPackageDotJson to return package.json without start script\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n await expect(updatePackageJsonScripts()).rejects.toThrow(\n 'Could not find a `start` script in your package.json. Please add: \"start\": \"react-router-serve ./build/server/index.js\" and re-run the wizard.',\n );\n });\n\n it('should handle unquoted NODE_OPTIONS in dev script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'NODE_OPTIONS=--loader ts-node/register react-router dev',\n start: 'react-router serve',\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should merge unquoted NODE_OPTIONS and wrap result in single quotes\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--loader ts-node/register --import ./instrument.server.mjs' react-router dev\",\n );\n });\n\n it('should handle unquoted NODE_OPTIONS in start script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n start:\n 'NODE_OPTIONS=--require ./dotenv-config.js react-router-serve ./build/server/index.js',\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should merge unquoted NODE_OPTIONS and prepend NODE_ENV\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--require ./dotenv-config.js --import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n });\n\n it('should handle quoted NODE_OPTIONS and standardize to single quotes', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'NODE_OPTIONS=\"--max-old-space-size=4096\" react-router dev',\n start: \"NODE_OPTIONS='--enable-source-maps' react-router serve\",\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should standardize to single quotes\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--max-old-space-size=4096 --import ./instrument.server.mjs' react-router dev\",\n );\n // Should prepend NODE_ENV=production to start script\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--enable-source-maps --import ./instrument.server.mjs' react-router serve\",\n );\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-setup.test.js","sourceRoot":"","sources":["../../../test/react-router/sdk-setup.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8D;AAE9D,MAAM,EAAE,UAAU,EAAE,GAAG,WAAE,CAAC,OAAO,CAAC,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACrB,MAAM,IAAI,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACrB,MAAM,KAAK,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACtB,MAAM,OAAO,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACxB,MAAM,KAAK,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC;IACtB,MAAM,OAAO,GAAG,WAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,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,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach } from 'vitest';\n\nconst { clackMocks } = vi.hoisted(() => {\n const info = vi.fn();\n const warn = vi.fn();\n const error = vi.fn();\n const success = vi.fn();\n const outro = vi.fn();\n const confirm = vi.fn(() => Promise.resolve(false)); // default to false for tests\n\n return {\n clackMocks: {\n info,\n warn,\n error,\n success,\n outro,\n confirm,\n },\n };\n});\n\nvi.mock('@clack/prompts', () => {\n return {\n __esModule: true,\n default: {\n log: {\n info: clackMocks.info,\n warn: clackMocks.warn,\n error: clackMocks.error,\n success: clackMocks.success,\n },\n outro: clackMocks.outro,\n confirm: clackMocks.confirm,\n },\n };\n});\n\nconst { existsSyncMock, readFileSyncMock, writeFileSyncMock } = vi.hoisted(\n () => {\n return {\n existsSyncMock: vi.fn(),\n readFileSyncMock: vi.fn(),\n writeFileSyncMock: vi.fn(),\n };\n },\n);\n\nconst { getPackageDotJsonMock, getPackageVersionMock } = vi.hoisted(() => ({\n getPackageDotJsonMock: vi.fn(),\n getPackageVersionMock: vi.fn(),\n}));\n\nvi.mock('../../src/utils/package-json', () => ({\n getPackageDotJson: getPackageDotJsonMock,\n getPackageVersion: getPackageVersionMock,\n}));\n\nvi.mock('fs', async () => {\n return {\n ...(await vi.importActual('fs')),\n existsSync: existsSyncMock,\n readFileSync: readFileSyncMock,\n writeFileSync: writeFileSyncMock,\n promises: {\n writeFile: vi.fn(),\n },\n };\n});\n\n// module-level mock for child_process.execSync\nvi.mock('child_process', () => ({\n __esModule: true,\n execSync: vi.fn(),\n}));\n\n// mock showCopyPasteInstructions and makeCodeSnippet used by templates\nvi.mock('../../src/utils/clack', () => {\n return {\n __esModule: true,\n showCopyPasteInstructions: vi.fn(() => Promise.resolve()),\n makeCodeSnippet: vi.fn(\n (\n colors: boolean,\n callback: (\n unchanged: (str: string) => string,\n plus: (str: string) => string,\n minus: (str: string) => string,\n ) => string,\n ) => {\n // Mock implementation that just calls the callback with simple string functions\n const unchanged = (str: string) => str;\n const plus = (str: string) => `+ ${str}`;\n const minus = (str: string) => `- ${str}`;\n return callback(unchanged, plus, minus);\n },\n ),\n getPackageDotJson: getPackageDotJsonMock,\n };\n});\n\nimport {\n isReactRouterV7,\n getReactRouterVersion,\n supportsInstrumentationAPI,\n supportsOnError,\n runReactRouterReveal,\n createServerInstrumentationFile,\n tryRevealAndGetManualInstructions,\n updatePackageJsonScripts,\n} from '../../src/react-router/sdk-setup';\nimport * as childProcess from 'child_process';\nimport type { Mock } from 'vitest';\nimport { getSentryInstrumentationServerContent } from '../../src/react-router/templates';\n\ndescribe('React Router SDK Setup', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n\n getPackageVersionMock.mockImplementation(\n (\n packageName: string,\n packageJson: {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n },\n ) => {\n if (packageJson.dependencies?.[packageName]) {\n return packageJson.dependencies[packageName];\n }\n if (packageJson.devDependencies?.[packageName]) {\n return packageJson.devDependencies[packageName];\n }\n return null;\n },\n );\n });\n\n describe('isReactRouterV7', () => {\n it('should return true for React Router v7+ in dependencies or devDependencies', () => {\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '7.0.0' } }),\n ).toBe(true);\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '^7.1.0' } }),\n ).toBe(true);\n expect(\n isReactRouterV7({\n devDependencies: { '@react-router/dev': '7.1.0' },\n }),\n ).toBe(true);\n });\n\n it('should return false for React Router v6 or missing dependency', () => {\n expect(\n isReactRouterV7({ dependencies: { '@react-router/dev': '6.28.0' } }),\n ).toBe(false);\n expect(isReactRouterV7({ dependencies: { react: '^18.0.0' } })).toBe(\n false,\n );\n expect(isReactRouterV7({})).toBe(false);\n });\n });\n\n describe('getReactRouterVersion', () => {\n it('should coerce range version from package.json', () => {\n expect(\n getReactRouterVersion({\n dependencies: { '@react-router/dev': '^7.8.2' },\n }),\n ).toBe('7.8.2');\n });\n\n it('should return undefined when package is not in package.json', () => {\n expect(\n getReactRouterVersion({ dependencies: { react: '^18.0.0' } }),\n ).toBeUndefined();\n expect(getReactRouterVersion({})).toBeUndefined();\n });\n });\n\n describe('supportsInstrumentationAPI', () => {\n it('should return true for React Router v7.15.0 or higher', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.15.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '^7.15.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.16.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '8.0.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n devDependencies: { '@react-router/dev': '7.15.0' },\n }),\n ).toBe(true);\n });\n\n it('should return false for React Router versions below v7.15.0', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.14.0' },\n }),\n ).toBe(false);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.0.0' },\n }),\n ).toBe(false);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '7.9.5' },\n }),\n ).toBe(false);\n });\n\n it('should return false when @react-router/dev is not installed', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { react: '^18.0.0' },\n }),\n ).toBe(false);\n expect(supportsInstrumentationAPI({})).toBe(false);\n });\n\n it('should handle semver range specifiers correctly', () => {\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '~7.15.0' },\n }),\n ).toBe(true);\n expect(\n supportsInstrumentationAPI({\n dependencies: { '@react-router/dev': '>=7.15.0' },\n }),\n ).toBe(true);\n });\n });\n\n describe('supportsOnError', () => {\n it('should return true for React Router v7.11.0 or higher', () => {\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '7.11.0' },\n }),\n ).toBe(true);\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '^7.11.0' },\n }),\n ).toBe(true);\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '7.12.0' },\n }),\n ).toBe(true);\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '8.0.0' },\n }),\n ).toBe(true);\n expect(\n supportsOnError({\n devDependencies: { '@react-router/dev': '7.11.0' },\n }),\n ).toBe(true);\n });\n\n it('should return false for React Router versions below v7.11.0', () => {\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '7.10.0' },\n }),\n ).toBe(false);\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '7.0.0' },\n }),\n ).toBe(false);\n expect(\n supportsOnError({\n dependencies: { '@react-router/dev': '7.8.2' },\n }),\n ).toBe(false);\n });\n\n it('should return false when @react-router/dev is not installed', () => {\n expect(\n supportsOnError({\n dependencies: { react: '^18.0.0' },\n }),\n ).toBe(false);\n expect(supportsOnError({})).toBe(false);\n });\n });\n\n describe('generateServerInstrumentation', () => {\n it('should generate server instrumentation file with all features enabled', () => {\n const dsn = 'https://sentry.io/123';\n const enableTracing = true;\n const enableProfiling = false;\n const enableLogs = true;\n\n const result = getSentryInstrumentationServerContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain('dsn: \"https://sentry.io/123\"');\n expect(result).toContain('tracesSampleRate: 1');\n expect(result).toContain('enableLogs: true');\n });\n\n it('should generate server instrumentation file when performance is disabled', () => {\n const dsn = 'https://sentry.io/123';\n const enableTracing = false;\n const enableProfiling = false;\n const enableLogs = false;\n\n const result = getSentryInstrumentationServerContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain('dsn: \"https://sentry.io/123\"');\n expect(result).toContain('tracesSampleRate: 0');\n expect(result).not.toContain('enableLogs: true');\n });\n });\n});\n\ndescribe('runReactRouterReveal', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('runs the reveal CLI when entry files are missing', () => {\n existsSyncMock.mockReturnValue(false);\n\n (childProcess.execSync as unknown as Mock).mockImplementation(() => 'ok');\n\n runReactRouterReveal();\n\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n });\n\n it('does not run the reveal CLI when entry files already exist', () => {\n existsSyncMock.mockReturnValue(true);\n\n (childProcess.execSync as unknown as Mock).mockReset();\n\n runReactRouterReveal();\n\n expect(childProcess.execSync).not.toHaveBeenCalled();\n });\n});\n\ndescribe('server instrumentation helpers', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('createServerInstrumentationFile writes instrumentation file and returns path', () => {\n writeFileSyncMock.mockImplementation(() => undefined);\n\n const path = createServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: true,\n profiling: false,\n });\n\n expect(path).toContain('instrument.server.mjs');\n expect(writeFileSyncMock).toHaveBeenCalled();\n const writtenCall = writeFileSyncMock.mock.calls[0] as unknown as [\n string,\n string,\n ];\n expect(writtenCall[0]).toEqual(\n expect.stringContaining('instrument.server.mjs'),\n );\n expect(writtenCall[1]).toEqual(\n expect.stringContaining('dsn: \"https://sentry.io/123\"'),\n );\n expect(writtenCall[1]).toEqual(\n expect.stringContaining('tracesSampleRate: 1'),\n );\n });\n});\n\ndescribe('tryRevealAndGetManualInstructions', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('should return true when user confirms and reveal command succeeds', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n 'Successfully generated entry files',\n );\n\n // Mock file existing after reveal\n existsSyncMock.mockReturnValueOnce(true);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(true);\n expect(clackMocks.confirm).toHaveBeenCalledWith({\n message: expect.stringContaining(\n 'Would you like to try running',\n ) as string,\n initialValue: true,\n });\n expect(clackMocks.info).toHaveBeenCalledWith(\n expect.stringContaining('Running'),\n );\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n expect(clackMocks.success).toHaveBeenCalledWith(\n expect.stringContaining('Found entry.client.tsx after running reveal'),\n );\n });\n\n it('should return false when user declines reveal operation', async () => {\n const missingFilename = 'entry.server.tsx';\n const filePath = '/app/entry.server.tsx';\n\n // Mock user declining the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(false);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(clackMocks.confirm).toHaveBeenCalled();\n expect(childProcess.execSync).not.toHaveBeenCalled();\n expect(clackMocks.info).not.toHaveBeenCalled();\n });\n\n it('should return false when reveal command succeeds but file still does not exist', async () => {\n const missingFilename = 'entry.client.jsx';\n const filePath = '/app/entry.client.jsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n 'Command output',\n );\n\n // Mock file NOT existing after reveal\n existsSyncMock.mockReturnValueOnce(false);\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(childProcess.execSync).toHaveBeenCalled();\n expect(clackMocks.warn).toHaveBeenCalledWith(\n expect.stringContaining(\n 'entry.client.jsx still not found after running reveal',\n ),\n );\n });\n\n it('should return false when reveal command throws an error', async () => {\n const missingFilename = 'entry.server.jsx';\n const filePath = '/app/entry.server.jsx';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync throwing an error\n const mockError = new Error('Command failed');\n (childProcess.execSync as unknown as Mock).mockImplementationOnce(() => {\n throw mockError;\n });\n\n const result = await tryRevealAndGetManualInstructions(\n missingFilename,\n filePath,\n );\n\n expect(result).toBe(false);\n expect(childProcess.execSync).toHaveBeenCalled();\n expect(clackMocks.warn).toHaveBeenCalledWith(\n expect.stringContaining('Failed to run npx react-router reveal'),\n );\n });\n\n it('should log command output when reveal succeeds', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n const commandOutput = 'Generated entry files successfully';\n\n // Mock user confirming the reveal operation\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding with output\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce(\n commandOutput,\n );\n\n // Mock file existing after reveal\n existsSyncMock.mockReturnValueOnce(true);\n\n await tryRevealAndGetManualInstructions(missingFilename, filePath);\n\n expect(clackMocks.info).toHaveBeenCalledWith(commandOutput);\n });\n\n it('should handle reveal command with proper parameters', async () => {\n const missingFilename = 'entry.client.tsx';\n const filePath = '/app/entry.client.tsx';\n\n // Mock user confirming\n clackMocks.confirm.mockResolvedValueOnce(true);\n\n // Mock execSync succeeding\n (childProcess.execSync as unknown as Mock).mockReturnValueOnce('ok');\n\n // Mock file existing\n existsSyncMock.mockReturnValueOnce(true);\n\n await tryRevealAndGetManualInstructions(missingFilename, filePath);\n\n expect(childProcess.execSync).toHaveBeenCalledWith(\n 'npx react-router reveal',\n {\n encoding: 'utf8',\n stdio: 'pipe',\n },\n );\n });\n});\n\ndescribe('updatePackageJsonScripts', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n vi.resetAllMocks();\n });\n\n it('should set NODE_ENV=production for both dev and start scripts (workaround for React Router v7 + React 19 issue)', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'react-router dev',\n start: 'react-router serve',\n build: 'react-router build',\n },\n };\n\n // Mock getPackageDotJson to return our test package.json\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n // Mock fs.promises.writeFile\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n // Verify writeFile was called\n expect(writeFileMock).toHaveBeenCalled();\n\n // Check the written package.json content\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Both dev and start scripts should use the correct filenames and commands according to documentation\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--import ./instrument.server.mjs' react-router dev\",\n );\n\n // Start script should have NODE_ENV=production before --import\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n\n // The build script should remain unchanged\n expect(writtenContent.scripts.build).toBe('react-router build');\n });\n\n it('should handle package.json with only start script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n start: 'react-router serve',\n },\n };\n\n // Mock getPackageDotJson to return our test package.json\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n // Mock fs.promises.writeFile\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n // Verify only start script is modified when dev doesn't exist\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n expect(writtenContent.scripts.dev).toBeUndefined();\n });\n\n it('should throw error when no start script exists', async () => {\n const mockPackageJson = {\n scripts: {\n build: 'react-router build',\n },\n };\n\n // Mock getPackageDotJson to return package.json without start script\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n await expect(updatePackageJsonScripts()).rejects.toThrow(\n 'Could not find a `start` script in your package.json. Please add: \"start\": \"react-router-serve ./build/server/index.js\" and re-run the wizard.',\n );\n });\n\n it('should handle unquoted NODE_OPTIONS in dev script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'NODE_OPTIONS=--loader ts-node/register react-router dev',\n start: 'react-router serve',\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should merge unquoted NODE_OPTIONS and wrap result in single quotes\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--loader ts-node/register --import ./instrument.server.mjs' react-router dev\",\n );\n });\n\n it('should handle unquoted NODE_OPTIONS in start script', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n start:\n 'NODE_OPTIONS=--require ./dotenv-config.js react-router-serve ./build/server/index.js',\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should merge unquoted NODE_OPTIONS and prepend NODE_ENV\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--require ./dotenv-config.js --import ./instrument.server.mjs' react-router-serve ./build/server/index.js\",\n );\n });\n\n it('should handle quoted NODE_OPTIONS and standardize to single quotes', async () => {\n const mockPackageJson: { scripts: Record<string, string> } = {\n scripts: {\n dev: 'NODE_OPTIONS=\"--max-old-space-size=4096\" react-router dev',\n start: \"NODE_OPTIONS='--enable-source-maps' react-router serve\",\n },\n };\n\n getPackageDotJsonMock.mockResolvedValue(mockPackageJson);\n\n const fsPromises = await import('fs');\n const writeFileMock = vi\n .spyOn(fsPromises.promises, 'writeFile')\n .mockResolvedValue();\n\n await updatePackageJsonScripts();\n\n const writtenContent = JSON.parse(\n writeFileMock.mock.calls[0]?.[1] as string,\n ) as { scripts: Record<string, string> };\n\n // Should standardize to single quotes\n expect(writtenContent.scripts.dev).toBe(\n \"NODE_OPTIONS='--max-old-space-size=4096 --import ./instrument.server.mjs' react-router dev\",\n );\n // Should prepend NODE_ENV=production to start script\n expect(writtenContent.scripts.start).toBe(\n \"NODE_ENV=production NODE_OPTIONS='--enable-source-maps --import ./instrument.server.mjs' react-router serve\",\n );\n });\n});\n"]}
|