22
33const process = require ( 'process' )
44
5+ const test = require ( 'ava' )
56const sinon = require ( 'sinon' )
67const lolex = require ( 'lolex' )
78
89// eslint-disable-next-line import/no-internal-modules
910const { EXIT_TIMEOUT } = require ( '../src/exit' )
1011
11- const { forEachEvent , startLogging } = require ( './helpers' )
12+ const { repeatEvents , startLogging } = require ( './helpers' )
1213
1314// Stub `process.exit()`
1415const stubProcessExit = function ( ) {
@@ -28,8 +29,8 @@ const emitEventAndWait = async function(timeout, { clock, emitEvent }) {
2829}
2930
3031/* eslint-disable max-nested-callbacks */
31- forEachEvent ( ( { eventName, emitEvent, test } ) => {
32- test ( ' should call process.exit(1) if inside opts.exitOn' , async t => {
32+ repeatEvents ( ( prefix , { eventName, emitEvent } ) => {
33+ test ( ` ${ prefix } should call process.exit(1) if inside opts.exitOn` , async t => {
3334 const { clock, processExit } = stubProcessExit ( )
3435
3536 const exitOn = [ eventName ]
@@ -45,7 +46,7 @@ forEachEvent(({ eventName, emitEvent, test }) => {
4546 unstubProcessExit ( { clock, processExit } )
4647 } )
4748
48- test ( ' should not call process.exit(1) if not inside opts.exitOn' , async t => {
49+ test ( ` ${ prefix } should not call process.exit(1) if not inside opts.exitOn` , async t => {
4950 const { clock, processExit } = stubProcessExit ( )
5051
5152 const exitOn = [ ]
@@ -60,7 +61,7 @@ forEachEvent(({ eventName, emitEvent, test }) => {
6061 unstubProcessExit ( { clock, processExit } )
6162 } )
6263
63- test ( ' should delay process.exit(1)' , async t => {
64+ test ( ` ${ prefix } should delay process.exit(1)` , async t => {
6465 const { clock, processExit } = stubProcessExit ( )
6566
6667 const { stopLogging } = startLogging ( { exitOn : [ eventName ] , eventName } )
0 commit comments