summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-underscore.js
AgeCommit message (Collapse)Author
2019-12-06repl: use better uncaught exceptions indicatorRuben Bridgewater
This switches "Thrown:" with "Uncaught" to outline clearer that the thrown error is not caught. PR-URL: https://github.com/nodejs/node/pull/29676 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-10util: change inspect compact and breakLength defaultRuben Bridgewater
This changes the `compact` default from `true` to `3`. That mode changes arrays to be grouped together, it alignes multiple small entries on a single line in similar to `compact` true but only for the most inner three depth levels and the closing brackets are always on the same indentation as the openeing of the object instead of at the same line as another property. Big strings will be naturally broken into multiple lines instead of having one huge line that is not well readable. The output size mainly stays the same that way while it will be smaller in case of big arrays. Increasing the `breakLength` to 80 adjusts for most terminals that support at least 80 characters in a single line and improves the general output that way. A lot of calculations use the `breakLength` to determine the concrete behavior. PR-URL: https://github.com/nodejs/node/pull/27109 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-03-14test: fix tests after V8 updateMichaël Zasso
Adapt to changes in async stack traces and function name inference PR-URL: https://github.com/nodejs/node/pull/25852 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
2019-03-10benchmark,doc,lib,test: capitalize commentsRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/26483 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-01-02repl: indicate if errors are thrown or notRuben Bridgewater
Currently an error is printed identical, no matter if it is just inspected or if the error is thrown inside of the REPL. This makes sure we are able to distinguish these cases. PR-URL: https://github.com/nodejs/node/pull/25253 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-12-17doc,lib,test: capitalize comment sentencesRuben Bridgewater
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: https://github.com/nodejs/node/pull/24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-10-17timers: run nextTicks after each immediate and timerAnatoli Papirovski
In order to better match the browser behaviour, run nextTicks (and subsequently the microtask queue) after each individual Timer and Immediate, rather than after the whole list is processed. The current behaviour is somewhat of a performance micro-optimization and also partly dictated by how timer handles were implemented. PR-URL: https://github.com/nodejs/node/pull/22842 Fixes: https://github.com/nodejs/node/issues/22257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-08-27repl: improve error outputRuben Bridgewater
1) Currently extra properties on an error will be ignored, if thrown. This information will from now on be visible. 2) In case someone threw a non error object it would have resulted in `[object Object]`. Instead, the full object will now be visible. 3) Some cases were not detected properly as error before and "Thrown: " was visible before. That is now fixed. PR-URL: https://github.com/nodejs/node/pull/22436 Refs: https://github.com/nodejs/node/issues/20253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-21util: improve error inspectionRuben Bridgewater
When inspecting errors with extra properties while setting the compact option to false, it will now return: [Error: foo] { at repl:1:5 at Script.runInThisContext (vm.js:89:20) bla: true } Instead of: Error: foo at repl:1:5 at Script.runInThisContext (vm.js:91:20) { bla: true } PR-URL: https://github.com/nodejs/node/pull/20802 Refs: https://github.com/nodejs/node/issues/20253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-20fs: refactor fs moduleJames M Snell
PR-URL: https://github.com/nodejs/node/pull/20764 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-03-04repl: make last error available as `_error`Anna Henningsen
This is pretty useful when trying to inspect the last error caught by a REPL, and is made to be analogous to `_`, which contains the last successful completion value. PR-URL: https://github.com/nodejs/node/pull/18919 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
2018-02-12Revert "repl: refactor tests to not rely on timing"Ruben Bridgewater
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>
2018-02-10repl: refactor tests to not rely on timingBradley Farias
Tests relying on synchronous timing have been migrated to use events. PR-URL: https://github.com/nodejs/node/pull/17828 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-01-15test,repl: add coverage for repl .clear+useGlobalRich Trott
Add a test to cover situation where REPL is initialized with `useGlobal` set to `true` and `.clear` is called. This adds coverage for code in repl.js that is not currently covered. Includes minor refactor of rocket functions in repl.js for concision. PR-URL: https://github.com/nodejs/node/pull/10777 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-19Revert "repl,util: insert carriage returns in output"Evan Lucas
This reverts commit fce4b981eacbce0b85a2418d042f1f67d40e9834. This was a breaking change and should have been marked semver-major. The change that was made altered the output of util.format() and util.inspect(). With how much those are used in the wild, this type of change deserves more justification. Fixes: https://github.com/nodejs/node/issues/8138 PR-URL: https://github.com/nodejs/node/pull/8143 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-13repl,util: insert carriage returns in outputJungMinu
`\n` is not enough for Linux with some custom stream add carriage returns to ensure that the output is displayed correctly using `\r\n` should not be a problem, even on non-Windows platforms. Fixes: https://github.com/nodejs/node/issues/7954 PR-URL: https://github.com/nodejs/node/pull/8028 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-03-18repl: Assignment of _ allowed with warningLance Ball
This commit addresses https://github.com/nodejs/node/issues/5431 by changing the way that the repl handles assignment to the global _ variable. Prior to this commit, node sets the result of the last expression evaluated in the repl to `_`. This causes problems for users of underscore, lodash and other packages where it is common to assign `_` to the package, e.g. `_ = require('lodash');`. Changes in this commit now result in the following behavior. - If unassigned on the repl, `_` continues to refer to the last evaluated expression. - If assigned, the default behavior of assigning `_` to the last evaluated expression is disabled, and `_` now references whatever value was explicitly set. A warning is issued on the repl - 'expression assignment to _ now disabled'. - If `_` is assigned multiple times, the warning is only displayed once. - When `.clear` is executed in the repl, `_` continues to refer to its most recent value, whatever that is (this is per existing behavior). If `_` had been explicitly set prior to `.clear` it will not change again with the evaluation of the next expression. PR-URL: https://github.com/nodejs/node/pull/5535 Fixes: https://github.com/nodejs/node/issues/5431 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com>