Skip to content

Commit

Permalink
fix: don't crash if total memory is not supported (#3879)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Aug 3, 2023
1 parent 0c53e09 commit 7d1f86b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vitest/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ export function resolveConfig(
snapshotEnvironment: null as any,
}

const memory = totalmem()

resolved.experimentalVmWorkerMemoryLimit = stringToBytes(
getWorkerMemoryLimit(resolved),
resolved.watch ? totalmem() / 2 : totalmem(),
typeof memory === 'number' && resolved.watch ? memory / 2 : memory,
)

if (options.resolveSnapshotPath)
Expand Down

0 comments on commit 7d1f86b

Please sign in to comment.