push
github
297 of 340 branches covered (87.35%)
Branch coverage included in aggregate %.
286 of 329 new or added lines in 25 files covered. (86.93%)
1361 of 1501 relevant lines covered (90.67%)
306.35 hits per line
|
import child_process from 'node:child_process' |
|
|
import fs from 'node:fs/promises' |
1✔ |
|
|
1✔ |
|
const fileExists = path => fs.access(path).then(() => !!1).catch(() => !!0) |
|
|
|
1✔ |
|
const onStdout = (cmd, { cwd }) => { |
1✔ |
NEW
|
const ctrlr = new AbortController()
|
× |
NEW
|
|
× |
NEW
|
return new Promise((resolve, reject) => { |
× |
NEW
|
const res = child_process.exec(cmd, { cwd, signal: ctrlr.signal })
|
× |
NEW
|
const timer = setTimeout(() => { |
× |
NEW
|
reject(new Error('Did not log in stdout within 1000ms'), 1000) |
× |
NEW
|
ctrlr.abort() |
× |
NEW
|
}) |
× |
NEW
|
|
× |
NEW
|
res.stderr.once('data', data => reject(new Error(data))) |
× |
NEW
|
res.stdout.once('data', data => {
|
× |
NEW
|
clearTimeout(timer) |
× |
NEW
|
resolve(data.toString()) |
× |
NEW
|
ctrlr.abort() |
× |
NEW
|
}) |
× |
NEW
|
}) |
× |
NEW
|
} |
× |
|
|
1✔ |
|
export { fileExists, onStdout }
|
1✔ |