diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-11 19:17:03 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-12 15:42:06 +0100 |
commit | 1fc373bdf6758dcf045db21e4a075e4099ca7c19 (patch) | |
tree | 6845172f59c4bdf9be6d37efadc502e867adb248 /test/parallel/test-repl-eval-scope.js | |
parent | 60c9ad797994e544af21ce991dce2c3360ae1801 (diff) | |
download | android-node-v8-1fc373bdf6758dcf045db21e4a075e4099ca7c19.tar.gz android-node-v8-1fc373bdf6758dcf045db21e4a075e4099ca7c19.tar.bz2 android-node-v8-1fc373bdf6758dcf045db21e4a075e4099ca7c19.zip |
Revert "repl: refactor tests to not rely on timing"
This reverts commit de848ac1e0483327a2ce8716c3f8567eaeacb660.
The commit broke multiline repl.
PR-URL: https://github.com/nodejs/node/pull/18715
Refs: https://github.com/nodejs/node/pull/17828
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-eval-scope.js')
-rw-r--r-- | test/parallel/test-repl-eval-scope.js | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/test/parallel/test-repl-eval-scope.js b/test/parallel/test-repl-eval-scope.js index 83311fd92c..00b577cba7 100644 --- a/test/parallel/test-repl-eval-scope.js +++ b/test/parallel/test-repl-eval-scope.js @@ -3,27 +3,21 @@ const common = require('../common'); const assert = require('assert'); const repl = require('repl'); -const exitTests = []; -process.on('exit', () => { - for (const test of exitTests) test(); -}); -const CONTEXT = { animal: 'Sterrance' }; -const stream = new common.ArrayStream(); -const options = { - eval: common.mustCall((cmd, context) => { - // need to escape the domain - exitTests.push(common.mustCall(() => { - assert.strictEqual(cmd, '.scope'); - assert.ok(context === CONTEXT); - })); - }), - input: stream, - output: stream, - terminal: true -}; +{ + const stream = new common.ArrayStream(); + const options = { + eval: common.mustCall((cmd, context) => { + assert.strictEqual(cmd, '.scope\n'); + assert.deepStrictEqual(context, { animal: 'Sterrance' }); + }), + input: stream, + output: stream, + terminal: true + }; -const r = repl.start(options); -r.context = CONTEXT; + const r = repl.start(options); + r.context = { animal: 'Sterrance' }; -stream.emit('data', '\t'); -stream.emit('.exit\n'); + stream.emit('data', '\t'); + stream.emit('.exit\n'); +} |