mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
fix: module excution
This commit is contained in:
parent
d2c8cf06b6
commit
6995c506f0
@ -94,7 +94,7 @@ export async function executeInViteNode(options: ExecuteOptions) {
|
||||
return stubRequests[id]
|
||||
|
||||
const transformed = await fetch(id)
|
||||
if (!transformed)
|
||||
if (transformed == null)
|
||||
throw new Error(`failed to load ${id}`)
|
||||
|
||||
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710
|
||||
|
||||
@ -178,6 +178,10 @@ export function posToNumber(
|
||||
const lines = source.split(splitRE)
|
||||
const { line, column } = pos
|
||||
let start = 0
|
||||
|
||||
if (line > lines.length)
|
||||
return source.length
|
||||
|
||||
for (let i = 0; i < line - 1; i++)
|
||||
start += lines[i].length + 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user