diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index c9b1952b996c5f..30bb1d1122a44a 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -141,6 +141,17 @@ const possibleTokensAfterIdentifier = [ '? 1: 1', ]; +const possibleTokensAfterIdentifierWithLineBreak = [ + '(\n)', + '[\n0]', + '+\n1', '- \n1', '* \n1', '/ \n1', '% \n1', '** \n1', + '== \n1', '=== \n1', '!= \n1', '!== \n1', '< \n1', '> \n1', '<= \n1', '>= \n1', + '&& \n1', '|| \n1', '?? \n1', + '= \n1', '+= \n1', '-= \n1', '*= \n1', '/= \n1', '%= \n1', + ': \n', + '? \n1: 1', +] + const errorTests = [ // Uncaught error throws and prints out { @@ -408,6 +419,16 @@ const errorTests = [ expect: 'undefined' } )), + { + send: 'npm = () => {};', + expect: '[Function: npm]' + }, + ...possibleTokensAfterIdentifierWithLineBreak.map((token) => ( + { + send: `npm ${token}; undefined`, + expect: '... undefined' + } + )), { send: '(function() {\n\nreturn 1;\n})()', expect: '... ... ... 1'