(metadata)
| 52 | } |
| 53 | |
| 54 | #writeFile (metadata) { |
| 55 | const globalStart = this.started |
| 56 | const globalEnd = this.#finished[INITIAL_TIMER] |
| 57 | const content = { |
| 58 | metadata, |
| 59 | timers: this.#finished, |
| 60 | // add any unfinished timers with their relative start/end |
| 61 | unfinishedTimers: [...this.#unfinished.entries()].reduce((acc, [name, start]) => { |
| 62 | acc[name] = [start - globalStart, globalEnd - globalStart] |
| 63 | return acc |
| 64 | }, {}), |
| 65 | } |
| 66 | fs.writeFileSync(this.#file, JSON.stringify(content) + '\n') |
| 67 | } |
| 68 | |
| 69 | #timeHandler = (level, name) => { |
| 70 | const now = Date.now() |
no test coverage detected