Skip to content

Conversation

@Its-treason
Copy link
Member

@Its-treason Its-treason commented Feb 10, 2024

Description

Closes: #263 & #922

Implemented the existing script- & test-runtime with node:vm to deprecate vm2. All runtimes are now combined in one file / function, because the other three runtimes before shared a lot of same code.

If you want to test this locally, you have to manually activate the runtime by changing the hard-coded if (false) to true, so it uses the new runtime.

Test collection for anyone wanting to try / test it:

https://cdn.discordapp.com/attachments/1036297730483564687/1227724527752974336/VM-Test.zip?ex=66297291&is=6616fd91&hm=63637d55a57c17b3b2fff3ca34d9b17bdcd0deb734a0d685f64b17bab21bd464&

@tonytvo
Copy link

tonytvo commented Jun 28, 2024

is it possible that we can get this merged?

@tonytvo
Copy link

tonytvo commented Aug 22, 2024

@helloanoop is there anything I can do to get this one merged in?

@brvaland
Copy link

@helloanoop @lohxt1 is it possible to prioritise review of this pull request to help unblock our team ?

If you can share timelines when your team will be able review will also help us plan migrate to Bruno.

Cc: @Its-treason

@helloanoop
Copy link
Contributor

@Its-treason We are prioritising Node VM support to be worked on. Let us know if you'd have time to fix the conflicts and update the PR ?

@Its-treason
Copy link
Member Author

Its-treason commented Jun 12, 2025

Sure, I would then migrate my updated implemented from: https://github.com/Its-treason/bruno/blob/lazer/packages/bruno-core/src/request/runtime/script-runner.ts If this implementation looks good to you.

Should I leave the if (false) in the code as a feature flag?

@helloanoop
Copy link
Contributor

Hey @Its-treason That sounds good. Please also remove the readme related changes in the PR.
We don't need a flag, In electron layer - we would make the change here to pass runtime as node

We still want to keep the vm2 code around in the runtime files for now.

@Its-treason
Copy link
Member Author

@helloanoop I updated the PR. I'm not sure about the latest developments with the testing runtime etc. but I guess you want to update this PR anyway, so I leave the rest to you.

Furthermore, I left some TODO-comments, should be looked at. The Script runtime currently writes global variables, this could be prevented by using the runInNewContext function, but then global Objects are missing in the script.

@lohit-bruno lohit-bruno mentioned this pull request Sep 6, 2025
5 tasks
@helloanoop
Copy link
Contributor

@Its-treason We made some more changes on top of your PR here and has been merged.

We are releasing it in our upcoming version v2.11.0 in Beta. Once stable, we will make it the default for Developer Mode in a 3.x release

@helloanoop helloanoop closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate VM2

5 participants