File size: 453 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
export function cliLog(/** @type {string | Record<string, any>} */ data) {
console.log('<test-log>' + JSON.stringify(data) + '</test-log>')
}
export function readCliLogs(/** @type {string} */ output) {
return output
.split('\n')
.map((line) => {
const match = line.match(/^<test-log>(?<value>.+?)<\/test-log>$/)
if (!match) {
return null
}
return JSON.parse(match.groups.value)
})
.filter(Boolean)
}
|