Unable to debug a dependency that contains only typescript source files
Describe the bug
I have a few internal dependencies that only contain typescript source files - no compiled javascript.
Until this point I've been using jest, and compilation and debugging these files has worked fine.
When migrating to vitest, compilation works, but I'm unable to set break points within these files.
Is there any config required to allow debugging the typescript source?
Reproduction
A nodejs typescript project compiling a published typescript package, built with tsc --noEmit.
A debug breakpoint set within the published typescript package is not hit.
System Info
IDE: Intellij IDEA
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Memory: 130.06 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
pnpm: 8.4.0 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 126.0.6478.185
Safari: 17.5
npmPackages:
vite: ^5.3.4 => 5.3.4
vitest: ^2.0.4 => 2.0.4
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Hello @josh-burton. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.
I'm unsure how to create a reproducible sample using stackblitz as I would need to publish another package to demonstrate that debugging does not work.
Is there a way to replicate publishing a package without actually publishing a package to npm?
You can also create
a minimal reproduction using a GitHub repository
and there have manually created node_modules which contains the package that demonstrates the issue. It doesn't have to be published package, just create it under node_modules and commit the changes to git remote.
You can also create
a minimal reproduction using a GitHub repository
and there have manually created
node_moduleswhich contains the package that demonstrates the issue. It doesn't have to be published package, just create it undernode_modulesand commit the changes to git remote.
ok thanks :) I'll do that.
@AriPerkkio I've created a reproducible sample here: https://github.com/josh-burton/vitest-debugging-bug
Are you able to reopen the issue?
The sample project has:
- a package called
my_dependencyinside of node_modules - a test called
index.test.ts
If a breakpoint is set inside index.test.ts, it is hit when debugging:
If a breakpoint is set inside of node_modules/my_dependency/src/repository/my_repository, it is never hit when debugging:
Some notes:
- the issue only happens in IntelliJ. VS Code is able to debug fine.
- I've noticed that if I use
npx linkwith the dependency (which symlinks the dependency into node_modules), I'm able to debug fine.
I've also filed a Youtrack issue for IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-357178/vitest-unable-to-hit-debug-breakpoint-inside-a-nodemodules-dependency