deno.land / x / oauth4webapi@v1.2.2 / conformance / .parse-logs.mjs

.parse-logs.mjs
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as events from 'node:events'import * as fs from 'node:fs'import * as readline from 'node:readline'
const input = process.argv.reverse()[0]
const rl = readline.createInterface({ input: fs.createReadStream(input), crlfDelay: Infinity,})
let currentFilelet testNamelet testId
rl.on('line', (line) => { line = line.substring(4) if (currentFile && line.includes('Test ID')) { throw new Error() }
if (line.includes('Test ID')) { testId = line.split(' ').reverse()[0] currentFile = `${testId}.txt` if (fs.existsSync(currentFile)) { fs.unlinkSync(currentFile) } }
if (line.includes('Test Name')) { testName = line.split(' ').reverse()[0] }
if (!currentFile) { return }
fs.writeFileSync(currentFile, `${line}\n`, { flag: 'a' })
if (line.includes('Test Finished') || line.includes('Test result is SKIPPED')) { fs.renameSync(currentFile, `${testName}-${testId}.txt`) currentFile = testName = testId = null }})
await events.once(rl, 'close')
oauth4webapi

Version Info

Tagged at
2 years ago