summaryrefslogtreecommitdiff
path: root/test/message
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-08-02 00:17:06 +0200
committerMichaël Zasso <targos@protonmail.com>2017-08-03 15:41:14 +0200
commitfb3d0e25cb38ec18f0318ccf1fcb97aa97baba61 (patch)
treebc827888d8e226a345a683d0b3d4a5354b03883c /test/message
parent5a050550d377c53a9249f218888ea2e92a4d48dc (diff)
downloadnode-new-fb3d0e25cb38ec18f0318ccf1fcb97aa97baba61.tar.gz
console,test: make message test more accurate
Make a message test more accurate in what it’s testing for. This requires not swallowing stack overflow RangeErrors in `console.log` and similar methods, which I would consider a bugfix in itself. PR-URL: https://github.com/nodejs/node/pull/14580 Fixes: https://github.com/nodejs/node-v8/issues/5 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/message')
-rw-r--r--test/message/console_low_stack_space.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/message/console_low_stack_space.js b/test/message/console_low_stack_space.js
index 1685a35a1f..6b4ae8f479 100644
--- a/test/message/console_low_stack_space.js
+++ b/test/message/console_low_stack_space.js
@@ -6,13 +6,20 @@ global.console = {};
require('../common');
+// This test checks that, if Node cannot put together the `console` object
+// because it is low on stack space while doing so, it can succeed later
+// once the stack has unwound a little, and `console` is in a usable state then.
+
+let compiledConsole;
+
function a() {
try {
return a();
} catch (e) {
- const console = consoleDescriptor.get();
- if (console.log) {
- console.log('Hello, World!');
+ compiledConsole = consoleDescriptor.get();
+ if (compiledConsole.log) {
+ // Using `console.log` itself might not succeed yet, but the code for it
+ // has been compiled.
} else {
throw e;
}
@@ -20,3 +27,5 @@ function a() {
}
a();
+
+compiledConsole.log('Hello, World!');