Skip to content

Commit

Permalink
test: guarantee test runs in test-readline-keys
Browse files Browse the repository at this point in the history
Use common.mustCall() to guarantee that test functions (created by a
factory function) are run.

PR-URL: #11023
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and evanlucas committed Jan 31, 2017
1 parent 9c2f686 commit 72a97b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/parallel/test-readline-keys.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 ];
Expand Down Expand Up @@ -84,7 +84,8 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
}
};
emitKeys(sequences);
};
});
return fn;
};

// regular alphanumerics
Expand Down

0 comments on commit 72a97b6

Please sign in to comment.