-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
oven-sh/WebKit
#101Labels
bugSomething isn't workingSomething isn't workingnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs
Description
What version of Bun is running?
1.2.15+df017990a
What platform is your computer?
Darwin 24.1.0 arm64 arm
What steps can reproduce the bug?
Run the following code:
import vm from 'vm';
const context = vm.createContext({
console,
}, {
microtaskMode: 'afterEvaluate',
});
const code = `
Promise.resolve().then(() => {
console.log('Microtask inside VM');
});
console.log('End of VM code');
`;
console.log('Before vm.runInContext');
Promise.resolve().then(() => {
console.log('Microtask outside VM');
});
vm.runInContext(code, context);
console.log('After vm.runInContext');What is the expected behavior?
In node environment:
$ npx tsx index.ts
Before vm.runInContext
End of VM code
Microtask inside VM
After vm.runInContext
Microtask outside VM
What do you see instead?
$ bun run index.ts
Before vm.runInContext
End of VM code
After vm.runInContext
Microtask outside VM
Microtask inside VM
Additional information
Currently it does seem like Bun doesn't respect the option. When I remove the option, then the output is the same for both environments
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs