oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.26k stars 2.69k forks source link

node:vm runInThisContext options is ignored #5221

Open ArtemGovorov opened 1 year ago

ArtemGovorov commented 1 year ago

What version of Bun is running?

1.0.1+31aec4ebe325982fc0ef27498984b0ad9969162b

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What steps can reproduce the bug?

test.js

try {
    require('node:vm').runInThisContext(`boom;`, { filename: 'sample.js', lineOffset: 2 })
} catch (e) {
    console.log(e.stack)
}

node

$ node test.js
sample.js:3
boom;
^

ReferenceError: boom is not defined
    at sample.js:3:1
    (irrelevant bits of stack)

bun

$ bun run test.js
ReferenceError: Can't find variable: boom
    at eval code (:1:5)
    (irrelevant bits of stack)

What is the expected behavior?

Instead of outputting the provided file name and using the provided line shift like node and printing at sample.js:3:1, Bun prints at eval code (:1:5).

What do you see instead?

No response

Additional information

No response

Jarred-Sumner commented 1 year ago

yeah we have not implemented these options yet