MCPcopy
hub / github.com/epicweb-dev/react-performance / shutdownHandler

Function shutdownHandler

epicshop/test.js:168–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 const results = new Map()
167
168 const shutdownHandler = () => {
169 if (isShuttingDown) return
170 isShuttingDown = true
171 console.log('\nGracefully shutting down. Please wait...')
172 console.log('Outputting results of running tests:')
173 for (const [app, output] of runningProcesses.entries()) {
174 if (output.hasOutput()) {
175 console.log(`\nPartial results for ${app.relativePath}:\n\n`)
176 output.replay()
177 console.log('\n\n')
178 } else {
179 console.log(`ℹ️ No output captured for ${app.relativePath}`)
180 }
181 // Set result for incomplete tests
182 if (!results.has(app.relativePath)) {
183 results.set(app.relativePath, 'Incomplete')
184 }
185 }
186 printTestSummary(results)
187 // Allow some time for output to be written before exiting
188 setTimeout(() => process.exit(1), 100)
189 }
190
191 process.on('SIGINT', shutdownHandler)
192 process.on('SIGTERM', shutdownHandler)

Callers

nothing calls this directly

Calls 1

printTestSummaryFunction · 0.85

Tested by

no test coverage detected