(id)
| 83 | return id |
| 84 | }, |
| 85 | getSourceMap(id) { |
| 86 | if (sourceMapCache.has(id)) { |
| 87 | return sourceMapCache.get(id) |
| 88 | } |
| 89 | |
| 90 | const result = environment.moduleGraph.getModuleById(id)?.transformResult |
| 91 | // handle non-inline source map such as pre-bundled deps in node_modules/.vite |
| 92 | if (result && !result.map) { |
| 93 | try { |
| 94 | const filePath = id.split('?')[0] |
| 95 | const extracted = extractSourcemapFromFile( |
| 96 | result.code, |
| 97 | filePath, |
| 98 | environment.config.logger, |
| 99 | ) |
| 100 | sourceMapCache.set(id, extracted?.map) |
| 101 | return extracted?.map |
| 102 | } catch { |
| 103 | sourceMapCache.set(id, null) |
| 104 | return null |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | sourceMapCache.set(id, result?.map) |
| 109 | return result?.map |
| 110 | }, |
| 111 | // override it to empty since vitest uses this option to skip internal files by default. |
| 112 | // https://github.com/vitest-dev/vitest/blob/4783137cd8d766cf998bdf2d638890eaa51e08d9/packages/utils/src/source-map.ts#L17 |
| 113 | ignoreStackEntries: [], |
nothing calls this directly
no test coverage detected