MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / persist

Function persist

lib/plugin/screenshot.js:352–386  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

350 }
351
352 function persist(test) {
353 if (!Object.keys(slides).length) return
354
355 const slideHtml = Object.keys(slides)
356 .sort()
357 .map((fileName, idx) => {
358 const step = slides[fileName]
359 const caption = step.toString().replace(/\[\d{2}m/g, '')
360 const failed = step.status === 'failed' ? ' is-failed' : ''
361 return template(SLIDE_TEMPLATE, {
362 image: fileName,
363 caption,
364 index: idx + 1,
365 activeClass: idx === 0 ? ' is-active' : '',
366 failed,
367 })
368 })
369 .join('')
370
371 const dotHtml = Object.keys(slides)
372 .map((_, idx) => `<button type="button" class="slides__dot${idx === 0 ? ' is-active' : ''}" data-slide="${idx}" aria-label="Step ${idx + 1}"></button>`)
373 .join('')
374
375 const html = template(SLIDESHOW_TEMPLATE, {
376 title: test.title,
377 feature: (test.parent && test.parent.title) || '',
378 slides: slideHtml,
379 dots: dotHtml,
380 animate: options.animateSlides ? 'true' : 'false',
381 })
382
383 const indexFile = path.join(dir, 'index.html')
384 fs.writeFileSync(indexFile, html)
385 recordedTests[`${(test.parent && test.parent.title) || ''}: ${test.title}`] = path.relative(reportDir, indexFile)
386 }
387}
388
389function makeStepFilter(trigger, options) {

Callers 1

wireSlidesFunction · 0.70

Calls 2

templateFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected