From 646f82520ca67aa63b1db3ab36f6644597a00a86 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 26 Jan 2017 09:10:38 -0800 Subject: [PATCH] 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 Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell --- test/parallel/test-readline-keys.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 6bbbb2e918..85e3f4df6f 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -1,10 +1,10 @@ 'use strict'; -require('../common'); -var PassThrough = require('stream').PassThrough; -var assert = require('assert'); -var inherits = require('util').inherits; -var extend = require('util')._extend; -var Interface = require('readline').Interface; +const common = require('../common'); +const PassThrough = require('stream').PassThrough; +const assert = require('assert'); +const inherits = require('util').inherits; +const extend = require('util')._extend; +const Interface = require('readline').Interface; function FakeInput() { @@ -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