Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions test/web-platform-tests/wpt-runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,28 @@ async function setup () {
`The WPT require certain entries to be present in your ${hostsPath} file. Should these be configured automatically? (y/n): `,
resolve
)
}).finally(() => rl.close())
}).finally(() => rl.close()).then((a) => a.trim().toLowerCase())

if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
await setupHostsFile()
} else {
let hostsModified = false
if (answer === 'y' || answer === 'yes') {
try {
await setupHostsFile()
hostsModified = true
} catch (err) {
console.error('❌ \x1B[31mAutomatic configuration failed.\x1B[0m')
}
}
if (!hostsModified) {
console.log('Please configure hosts file manually:')
console.log(`cd ${WPT_DIR}`)
if (process.platform === 'win32') {
console.log('python wpt make-hosts-file | Out-File $env:SystemRoot\\System32\\drivers\\etc\\hosts -Encoding ascii -Append')
} else {
console.log('python3 wpt make-hosts-file | sudo tee -a /etc/hosts')
}

console.log('❌ \x1B[31mSetup incomplete.\x1B[0m')
process.exit(1)
}
}

Expand Down
Loading