This commit is contained in:
wuls 2023-05-24 15:47:16 +08:00 committed by Nate Moore
parent ae8c22cfb2
commit 41cd7bb939
3 changed files with 4 additions and 2 deletions

View file

@ -190,6 +190,7 @@ export async function loadFixture(inlineConfig) {
const previewServer = await preview(mergeConfig(inlineConfig, extraInlineConfig));
config.server.host = parseAddressToHost(previewServer.host); // update host
config.server.port = previewServer.port; // update port
console.log(config.server.port, config.server.host, 'test')
return previewServer;
},
pathExists: (p) => fs.existsSync(new URL(p.replace(/^\//, ''), config.outDir)),

View file

@ -30,7 +30,8 @@
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"dev": "astro-scripts dev \"src/**/*.ts\"",
"test": "mocha --exit --timeout 20000 test/"
"test": "mocha --exit --timeout 20000 test/",
"t": "mocha --exit --timeout 20000 test/well-known-locations.test.js"
},
"dependencies": {
"@astrojs/webapi": "^2.2.0",

View file

@ -29,7 +29,7 @@ export function getNetworkAddress(protocol: Protocol = 'http', hostname: string,
detail.family === 4),
)
.forEach((detail) => {
let host = detail.address.replace('127.0.0.1', hostname === undefined || wildcardHosts.has(hostname) ? '127.0.0.1' : hostname)
let host = detail.address.replace('127.0.0.1', hostname === undefined || wildcardHosts.has(hostname) ? 'localhost' : hostname)
// ipv6 host
if (host.includes(':')) {
host = `[${host}]`