fix(node): handle dependency stack traces with external source maps in non-browser mode#9047
fix(node): handle dependency stack traces with external source maps in non-browser mode#9047iclectic wants to merge 7 commits intovitest-dev:mainfrom
Conversation
…n non-browser mode Fixes #9003 (non-browser mode) The previous fix in 57ea647 only addressed browser mode. This PR extends the fix to non-browser mode (threads, forks, vmThreads) by: - Adding getSourceMap option to non-browser parseErrorStacktrace calls - Creating retrieveSourceMapURL helper to extract source map URLs - Adding logic to read external source map files from disk - Handling missing source maps gracefully with try-catch - Adding comprehensive tests across all execution modes
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
packages/vitest/src/node/test-run.ts
Outdated
| } | ||
| } | ||
|
|
||
| function retrieveSourceMapURL(source: string): string | null { |
There was a problem hiding this comment.
If we merge this PR, this function will be defined 4 times. Can't you just export it from some util and use it?
|
I have incorporated the feedback by extracting the retrieveSourceMapURL function into a shared utility within @vitest/utils/source-map. Summary of Updates
About the CI Failures
Dependency trust error
Everything introduced in this PR has been validated locally and behaves as expected. |
| expect(stderr).not.toContain('FAIL') | ||
| }) | ||
|
|
||
| test('should parse stack traces with external source maps in error output', async () => { |
There was a problem hiding this comment.
Can you explain how this test case is testing external library's source map? It looks like it's importing as user's file via import './bundled-lib.js'.
Description
Resolves #9003
Changes
Tests
Related
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
Changesets
fix:prefix for automatic changelog generation.