fix: undefined host in listening on message (#3595)

Fix error in #3529
This commit is contained in:
Clark Du 2018-07-26 17:38:15 +01:00 committed by GitHub
parent 859d632771
commit 5bdd0dd8a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -129,7 +129,7 @@ export default class Nuxt {
return reject(err) return reject(err)
} }
({ host, port } = server.address()) ({ address: host, port } = server.address())
if (['127.0.0.1', '0.0.0.0'].includes(host)) { if (['127.0.0.1', '0.0.0.0'].includes(host)) {
host = 'localhost' host = 'localhost'
} }

View File

@ -40,7 +40,8 @@ describe.skip.appveyor('cli', () => {
} }
expect(error).toBe(undefined) expect(error).toBe(undefined)
expect(stdout.includes('Listening on')).toBe(true) expect(stdout.includes('Listening on ')).toBe(true)
expect(stdout.includes(`http://localhost:${port}`)).toBe(true)
const html = await rp(url('/')) const html = await rp(url('/'))
expect(html).toMatch(('<div>CLI Test</div>')) expect(html).toMatch(('<div>CLI Test</div>'))