added async await functionality for scripts, tests. sync execution of asserts using quick-js (#2846)

This commit is contained in:
lohit
2024-08-16 18:11:40 +05:30
committed by GitHub
parent 7182ef3479
commit a42689a717
16 changed files with 820 additions and 235 deletions

View File

@@ -28,7 +28,7 @@ const fetch = require('node-fetch');
const chai = require('chai');
const CryptoJS = require('crypto-js');
const NodeVault = require('node-vault');
const { executeInIsolatedVMAsync } = require('../sandbox/isolatedvm');
const { executeQuickJsVmAsync } = require('../sandbox/quickjs');
class ScriptRuntime {
constructor(props) {
@@ -89,22 +89,22 @@ class ScriptRuntime {
};
}
if (this.runtime === 'isolated-vm') {
await executeInIsolatedVMAsync({
if (this.runtime === 'quickjs') {
await executeQuickJsVmAsync({
script: script,
context: context,
modules: {},
scriptType: 'jsScript'
});
return {
request,
envVariables: cleanJson(envVariables),
runtimeVariables: cleanJson(runtimeVariables),
nextRequestName: bru.nextRequest
};
}
return {
request,
envVariables: cleanJson(envVariables),
runtimeVariables: cleanJson(runtimeVariables),
nextRequestName: bru.nextRequest
};
// default runtime is vm2
const vm = new NodeVM({
sandbox: context,
@@ -202,8 +202,8 @@ class ScriptRuntime {
};
}
if (this.runtime === 'isolated-vm') {
await executeInIsolatedVMAsync({
if (this.runtime === 'quickjs') {
await executeQuickJsVmAsync({
script: script,
context: context,
modules: {},