MCPcopy
hub / github.com/codeceptjs/CodeceptJS / nth

Method nth

lib/utils/trace.js:283–290  ·  view source on GitHub ↗
(n, kind)

Source from the content-addressed store, hash-verified

281 // Read content of the n-th file of `kind`. Binary kinds (screenshot) are
282 // returned as Buffer; text kinds as utf8 string.
283 nth(n, kind) {
284 const p = this.pathAt(n, kind)
285 if (!p) return null
286 try {
287 if (kind === 'screenshot') return fs.readFileSync(p)
288 return fs.readFileSync(p, 'utf8')
289 } catch { return null }
290 }
291
292 first(kind) { return this.nth(0, kind) }
293 last(kind) { return this.nth(-1, kind) }

Callers 4

firstMethod · 0.95
lastMethod · 0.95
switchToMethod · 0.80
trace_test.jsFile · 0.80

Calls 1

pathAtMethod · 0.95

Tested by

no test coverage detected