From 652782d1374600ebb0447e2323094ad2c8616823 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Sun, 13 Mar 2016 13:59:33 -0700 Subject: [PATCH] test: update test-repl-require for local paths Currently we are not testing that resolution of local paths is resolved first in the repl. This addition to `test-repl-require` adds an additional fixture an ensures we won't regress in the future PR-URL: https://github.com/nodejs/node/pull/5689 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Jeremiah Senkpiel --- test/fixtures/baz.js | 1 + test/parallel/test-repl-require.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/baz.js diff --git a/test/fixtures/baz.js b/test/fixtures/baz.js new file mode 100644 index 00000000000000..3187340bcbf376 --- /dev/null +++ b/test/fixtures/baz.js @@ -0,0 +1 @@ +module.exports = 'perhaps I work'; diff --git a/test/parallel/test-repl-require.js b/test/parallel/test-repl-require.js index c964951c2cacd8..2638b9643c17ec 100644 --- a/test/parallel/test-repl-require.js +++ b/test/parallel/test-repl-require.js @@ -23,11 +23,11 @@ server.listen(options, function() { const conn = net.connect(options); conn.setEncoding('utf8'); conn.on('data', (data) => answer += data); - conn.write('require("baz")\n.exit\n'); + conn.write('require("baz")\nrequire("./baz")\n.exit\n'); }); process.on('exit', function() { assert.strictEqual(false, /Cannot find module/.test(answer)); assert.strictEqual(false, /Error/.test(answer)); - assert.strictEqual(true, /eye catcher/.test(answer)); + assert.strictEqual(answer, '\'eye catcher\'\n\'perhaps I work\'\n'); });