Return failure status when playlist checks are offline (#49872)

* fix: fail playlist tests when offline

* test: move offline playlist check into test suite
This commit is contained in:
chen zhihao
2026-09-03 22:42:56 +02:00
committed by GitHub
parent b618525815
commit 2c21f19496
3 changed files with 25 additions and 8 deletions
+5 -7
View File
@@ -58,6 +58,7 @@ const rootStorage = new Storage(ROOT_DIR)
async function main() {
if (await isOffline()) {
logger.error(chalk.red('Internet connection is required for the script to work'))
process.exitCode = 1
return
}
@@ -195,13 +196,10 @@ async function onFinish(error: Error | null | undefined) {
process.exit(0)
}
async function isOffline() {
return new Promise((resolve, reject) => {
dns.lookup('info.cern.ch', err => {
if (err) resolve(true)
reject(false)
})
}).catch(() => {})
async function isOffline(): Promise<boolean> {
return new Promise(resolve => {
dns.lookup('info.cern.ch', err => resolve(Boolean(err)))
})
}
function getColor(stream: Stream): string {