| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2879ce9 commit a983726
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -931,7 +931,9 @@ function REPLServer(prompt, | |||
| 931 | 931 | ReflectApply(_memory, self, [cmd]); | |
| 932 | 932 | ||
| 933 | 933 | if (e && !self[kBufferedCommandSymbol] && | |
| 934 | - StringPrototypeStartsWith(StringPrototypeTrim(cmd), 'npm ')) { | ||
| 934 | + StringPrototypeStartsWith(StringPrototypeTrim(cmd), 'npm ') && | ||
| 935 | + !(e instanceof Recoverable) | ||
| 936 | + ) { | ||
| 935 | 937 | self.output.write('npm should be run outside of the ' + | |
| 936 | 938 | 'Node.js REPL, in your normal shell.\n' + | |
| 937 | 939 | '(Press Ctrl+D to exit.)\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,6 +129,17 @@ const strictModeTests = [ | |||
| 129 | 129 | }, | |
| 130 | 130 | ]; | |
| 131 | 131 | ||
| 132 | + const possibleTokensAfterIdentifierWithLineBreak = [ | ||
| 133 | + '(\n)', | ||
| 134 | + '[\n0]', | ||
| 135 | + '+\n1', '- \n1', '* \n1', '/ \n1', '% \n1', '** \n1', | ||
| 136 | + '== \n1', '=== \n1', '!= \n1', '!== \n1', '< \n1', '> \n1', '<= \n1', '>= \n1', | ||
| 137 | + '&& \n1', '|| \n1', '?? \n1', | ||
| 138 | + '= \n1', '+= \n1', '-= \n1', '*= \n1', '/= \n1', '%= \n1', | ||
| 139 | + ': \n', | ||
| 140 | + '? \n1: 1', | ||
| 141 | + ]; | ||
| 142 | + | ||
| 132 | 143 | const errorTests = [ | |
| 133 | 144 | // Uncaught error throws and prints out | |
| 134 | 145 | { | |
@@ -380,6 +391,16 @@ const errorTests = [ | |||
| 380 | 391 | '(Press Ctrl+D to exit.)', | |
| 381 | 392 | ] | |
| 382 | 393 | }, | |
| 394 | + { | ||
| 395 | + send: 'let npm = () => {};', | ||
| 396 | + expect: 'undefined' | ||
| 397 | + }, | ||
| 398 | + ...possibleTokensAfterIdentifierWithLineBreak.map((token) => ( | ||
| 399 | + { | ||
| 400 | + send: `npm ${token}; undefined`, | ||
| 401 | + expect: '... undefined' | ||
| 402 | + } | ||
| 403 | + )), | ||
| 383 | 404 | { | |
| 384 | 405 | send: '(function() {\n\nreturn 1;\n})()', | |
| 385 | 406 | expect: '... ... ... 1' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments