Skip to content

chore(internal): Add scripts for debug compilation and testing#8360

Merged
jsklan merged 11 commits intomainfrom
jsklan/add-debug-scripts
Jul 25, 2025
Merged

chore(internal): Add scripts for debug compilation and testing#8360
jsklan merged 11 commits intomainfrom
jsklan/add-debug-scripts

Conversation

@jsklan
Copy link
Copy Markdown
Contributor

@jsklan jsklan commented Jul 25, 2025

Description

compile:debug -- compiles projects with the --sourceMap flag for type linking
test:debug -- runs pnpm test with --inspect flag

Changes Made

  • also added configs to turbo.json to hook into these commands
  • still requires manual attachment of debugger after test process starts
    • Cmd+Shift+P -> Debug: Attach to Node Process
  • also modified top level depcheck script to use turbo
  • Updated CONTRIBUTING.md with the following section:

Debugging

For debugging TypeScript code in tests, use the debug compilation and test scripts:

  1. Compile for debugging: pnpm compile:debug

    • Required for all debug workflows
    • Uses --sourceMap flag to generate source maps for proper TypeScript debugging
    • Slower than standard compilation, which is why source maps are disabled by default
  2. Run tests with debugger: pnpm test:debug [test-file-name]

    • Starts tests with Node.js debugger enabled
    • Optionally specify a test file name to run only that test
    • Manually attach VS Code debugger by opening Command Palette (Cmd+Shift+P) and selecting "Debug: Attach to Node > Process"

Limitations: Debug scripts only work with vitest tests. Some -- but not all -- of the workflows they won't work with:

  • Local Fern CLI builds (compiled to single executable CJS file)
  • Generators (run in Docker containers, not all written in TypeScript)

@promptless
Copy link
Copy Markdown

promptless bot commented Jul 25, 2025

✅ No documentation updates required.

@jsklan jsklan changed the title chore(dev): Add compile:debug and test:debug scripts to ts node packages chore(dev): Add scripts for debug compilation and testing Jul 25, 2025
@jsklan jsklan changed the title chore(dev): Add scripts for debug compilation and testing chore(internal): Add scripts for debug compilation and testing Jul 25, 2025
@jsklan jsklan merged commit 66f88d4 into main Jul 25, 2025
31 of 42 checks passed
@jsklan jsklan deleted the jsklan/add-debug-scripts branch July 25, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants