[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix(vitest): support older NodeJS with async `import.meta.resolve` (#5045)

authored by

Ari Perkkiö and committed by
GitHub
(Jan 26, 2024, 7:10 AM +0200) cf5641a9 915d6c43

+7 -1
+7 -1
packages/vitest/src/runtime/external-executor.ts
··· 71 71 } 72 72 73 73 public resolveModule = async (specifier: string, referencer: string) => { 74 - const identifier = this.resolve(specifier, referencer) 74 + let identifier = this.resolve(specifier, referencer) as string | Promise<string> 75 + 76 + if (identifier instanceof Promise) 77 + identifier = await identifier 78 + 75 79 return await this.createModule(identifier) 76 80 } 77 81 ··· 81 85 if (id) 82 86 return id 83 87 } 88 + 89 + // import.meta.resolve can be asynchronous in older +18 Node versions 84 90 return nativeResolve(specifier, parent) 85 91 } 86 92