chore: fix tests in node 18 (#5266)

This commit is contained in:
wulinsheng123 2022-11-03 23:31:26 +08:00 committed by GitHub
parent 89f335b539
commit e3cddb433d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View file

@ -10,6 +10,7 @@ scripts/memory/project/src/pages/
package-lock.json
.turbo/
.eslintcache
.pnpm-store
# ignore top-level vscode settings
/.vscode/settings.json

View file

@ -70,6 +70,14 @@ export async function loadFixture(inlineConfig) {
if (!inlineConfig || !inlineConfig.root)
throw new Error("Must provide { root: './fixtures/...' }");
// Compatible with different Node versions (https://vitejs.dev/guide/migration.html#dev-server-changes)
// TODO: Remove this to test in Node >= 17 where the dns resolver is verbatim
if (!inlineConfig?.server) {
inlineConfig.server = {
host: '127.0.0.1'
}
}
// load config
let cwd = inlineConfig.root;
delete inlineConfig.root;