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 <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Myles Borins 2016-03-13 13:59:33 -07:00 committed by Phillip Johnsen
parent d38503ab01
commit 652782d137
2 changed files with 3 additions and 2 deletions

1
test/fixtures/baz.js vendored Normal file
View File

@ -0,0 +1 @@
module.exports = 'perhaps I work';

View File

@ -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');
});