Skip to content

Commit 646f825

Browse files
TrottMylesBorins
authored andcommitted
test: guarantee test runs in test-readline-keys
Use common.mustCall() to guarantee that test functions (created by a factory function) are run. PR-URL: #11023 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d8eed12 commit 646f825

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/parallel/test-readline-keys.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
2-
require('../common');
3-
var PassThrough = require('stream').PassThrough;
4-
var assert = require('assert');
5-
var inherits = require('util').inherits;
6-
var extend = require('util')._extend;
7-
var Interface = require('readline').Interface;
2+
const common = require('../common');
3+
const PassThrough = require('stream').PassThrough;
4+
const assert = require('assert');
5+
const inherits = require('util').inherits;
6+
const extend = require('util')._extend;
7+
const Interface = require('readline').Interface;
88

99

1010
function FakeInput() {
@@ -55,7 +55,7 @@ function addTest(sequences, expectedKeys) {
5555

5656
const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
5757
assertDelay = 550) => {
58-
return (next) => () => {
58+
const fn = common.mustCall((next) => () => {
5959

6060
if (!Array.isArray(sequences)) {
6161
sequences = [ sequences ];
@@ -84,7 +84,8 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
8484
}
8585
};
8686
emitKeys(sequences);
87-
};
87+
});
88+
return fn;
8889
};
8990

9091
// regular alphanumerics

0 commit comments

Comments
 (0)