Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
also committed Feb 19, 2018
1 parent 5d7f355 commit 328a9cf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,20 @@ test('detach child process', async t => {

t.is(fs.readFileSync(file, 'utf8'), 'foo\n');
});

// https://github.com/sindresorhus/execa/issues/128
test('removes exit handler on exit', async t => {
// TODO this relies on signal-exit internals
const ee = process.__signal_exit_emitter__;

const child = m('noop');
const listener = ee.listeners('exit').pop();

await new Promise((resolve, reject) => {
child.on('error', reject);
child.on('exit', resolve);
});

const included = ee.listeners('exit').includes(listener);
t.false(included);
})

0 comments on commit 328a9cf

Please sign in to comment.