- Version:
14.17.0, 16.1.0, 16.4.0 and very likely all between
- Platform: Microsoft Windows NT 10.0.19042.0 x64
- Subsystem: vm
What steps will reproduce the bug?
const {Script} = require('vm');
try {
const script = new Script(`Math.max(a, b`, {filename: 'main'});
} catch (error) {
console.log(error.stack);
}
Executing the snippet will display the source code line with the marker ^ where the error happened:
main:1
Math.max(a, b
^
SyntaxError: missing ) after argument list
at new Script (vm.js:101:7)
...
But when executing node with --enable-source-maps the source code line with the marker is not displayed:
SyntaxError: missing ) after argument list
at new Script (vm.js:101:7)
...
How often does it reproduce? Is there a required condition?
It does always reproduce. I have tested on node 14.17.0, 16.1.0 and 16.4.0.
What is the expected behavior?
Always display the source location with the marker ^ no matter whether --enable-source-maps is set or not.
What do you see instead?
Additional information
On node 14.16.1 the source code line with the marker is always displayed no matter whether --enable-source-maps is set or not. I have looked into the Changelog and I think that maybe #33491 has introduced this bug.