Skip to content

Commit

Permalink
Fix exit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Demedes committed May 7, 2020
1 parent 360d2da commit 2913ecf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/exit.tsx
Expand Up @@ -62,7 +62,20 @@ test.cb('don’t exit while raw mode is active', t => {
let output = '';

term.on('data', data => {
output += data;
if (data === 's') {
setTimeout(() => {
t.false(isExited);
term.write('q');
}, 2000);

setTimeout(() => {
term.kill();
t.fail();
t.end();
}, 5000);
} else {
output += data;
}
});

let isExited = false;
Expand All @@ -80,15 +93,4 @@ test.cb('don’t exit while raw mode is active', t => {
t.fail();
t.end();
});

setTimeout(() => {
t.false(isExited);
term.write('q');
}, 2000);

setTimeout(() => {
term.kill();
t.fail();
t.end();
}, 5000);
});
3 changes: 3 additions & 0 deletions test/fixtures/exit-double-raw-mode.tsx
Expand Up @@ -16,6 +16,9 @@ class ExitDoubleRawMode extends React.Component<{
setTimeout(() => {
setRawMode(false);
setRawMode(true);

// Start the test
process.stdout.write('s');
}, 500);
}
}
Expand Down

0 comments on commit 2913ecf

Please sign in to comment.