MCPcopy Create free account
hub / github.com/nodejs/node / makeOldLogs

Function makeOldLogs

deps/npm/test/lib/utils/log-file.js:16–32  ·  view source on GitHub ↗
(count, oldStyle)

Source from the content-addressed store, hash-verified

14const last = arr => arr[arr.length - 1]
15const range = (n) => Array.from(Array(n).keys())
16const makeOldLogs = (count, oldStyle) => {
17 const d = new Date()
18 d.setHours(-1)
19 d.setSeconds(0)
20 return range(oldStyle ? count : (count / 2)).reduce((acc, i) => {
21 const cloneDate = new Date(d.getTime())
22 cloneDate.setSeconds(i)
23 const dateId = getId(cloneDate)
24 if (oldStyle) {
25 acc[`${dateId}-debug.log`] = 'hello'
26 } else {
27 acc[`${dateId}-debug-0.log`] = 'hello'
28 acc[`${dateId}-debug-1.log`] = 'hello'
29 }
30 return acc
31 }, {})
32}
33
34const cleanErr = (message) => {
35 const err = new Error(message)

Callers 1

log-file.jsFile · 0.85

Calls 3

getIdFunction · 0.85
reduceMethod · 0.80
rangeFunction · 0.70

Tested by

no test coverage detected