Skip to content

Commit 7d1f86b

Browse files
authored
fix: don't crash if total memory is not supported (#3879)
1 parent 0c53e09 commit 7d1f86b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/vitest/src/node/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ export function resolveConfig(
213213
snapshotEnvironment: null as any,
214214
}
215215

216+
const memory = totalmem()
217+
216218
resolved.experimentalVmWorkerMemoryLimit = stringToBytes(
217219
getWorkerMemoryLimit(resolved),
218-
resolved.watch ? totalmem() / 2 : totalmem(),
220+
typeof memory === 'number' && resolved.watch ? memory / 2 : memory,
219221
)
220222

221223
if (options.resolveSnapshotPath)

0 commit comments

Comments
 (0)