diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 424f9a421893f9..7422efc13ab26a 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -330,7 +330,7 @@ const consoleMethods = { name: 'Trace', message: this[kFormatForStderr](args) }; - Error.captureStackTrace(err, trace); + Error.captureStackTrace(err, this.trace); this.error(err.stack); }, diff --git a/test/message/console.js b/test/message/console.js new file mode 100644 index 00000000000000..e93e27b3d4f5d2 --- /dev/null +++ b/test/message/console.js @@ -0,0 +1,5 @@ +'use strict'; + +require('../common'); + +console.trace('foo'); diff --git a/test/message/console.out b/test/message/console.out new file mode 100644 index 00000000000000..0ede283a54a25c --- /dev/null +++ b/test/message/console.out @@ -0,0 +1,10 @@ +Trace: foo + at Console.trace (*) + at Object. (*console.js:*:*) + at * + at * + at * + at * + at * + at * + at *