summaryrefslogtreecommitdiff
path: root/test/parallel/test-readline-keys.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-01-26 09:10:38 -0800
committerRich Trott <rtrott@gmail.com>2017-01-29 15:37:07 -0800
commit87b4486da2fe8b74e2fcdb16928092f82a8be755 (patch)
tree34f3f2b3e39a2b20e97782c2d252a331a7aacc5c /test/parallel/test-readline-keys.js
parentae21a51154d5e2b909e3e770767c6aa92ecc105d (diff)
downloadandroid-node-v8-87b4486da2fe8b74e2fcdb16928092f82a8be755.tar.gz
android-node-v8-87b4486da2fe8b74e2fcdb16928092f82a8be755.tar.bz2
android-node-v8-87b4486da2fe8b74e2fcdb16928092f82a8be755.zip
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: https://github.com/nodejs/node/pull/11023 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-readline-keys.js')
-rw-r--r--test/parallel/test-readline-keys.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js
index 2581276556..f45bcb97e0 100644
--- a/test/parallel/test-readline-keys.js
+++ b/test/parallel/test-readline-keys.js
@@ -1,5 +1,5 @@
'use strict';
-require('../common');
+const common = require('../common');
const PassThrough = require('stream').PassThrough;
const assert = require('assert');
const inherits = require('util').inherits;
@@ -55,7 +55,7 @@ function addTest(sequences, expectedKeys) {
const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
assertDelay = 550) => {
- return (next) => () => {
+ const fn = common.mustCall((next) => () => {
if (!Array.isArray(sequences)) {
sequences = [ sequences ];
@@ -84,7 +84,8 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
}
};
emitKeys(sequences);
- };
+ });
+ return fn;
};
// regular alphanumerics