fix(#178): fixed await issue while running scripts

This commit is contained in:
Anoop M D 2023-09-01 17:49:34 +05:30
parent 08495e7fb5
commit b25d896dd6
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@usebruno/cli",
"version": "0.6.1",
"version": "0.6.2",
"main": "src/index.js",
"bin": {
"bru": "./bin/bru.js"

View File

@ -36,7 +36,7 @@ const runSingleRequest = async function (filename, bruJson, collectionPath, coll
const requestScriptFile = get(bruJson, 'request.script.req');
if(requestScriptFile && requestScriptFile.length) {
const scriptRuntime = new ScriptRuntime();
scriptRuntime.runRequestScript(requestScriptFile, request, envVariables, collectionVariables, collectionPath);
await scriptRuntime.runRequestScript(requestScriptFile, request, envVariables, collectionVariables, collectionPath);
}
// interpolate variables inside request
@ -63,7 +63,7 @@ const runSingleRequest = async function (filename, bruJson, collectionPath, coll
const responseScriptFile = get(bruJson, 'request.script.res');
if(responseScriptFile && responseScriptFile.length) {
const scriptRuntime = new ScriptRuntime();
scriptRuntime.runResponseScript(responseScriptFile, request, response, envVariables, collectionVariables, collectionPath);
await scriptRuntime.runResponseScript(responseScriptFile, request, response, envVariables, collectionVariables, collectionPath);
}
// run assertions
@ -121,7 +121,7 @@ const runSingleRequest = async function (filename, bruJson, collectionPath, coll
const responseScriptFile = get(bruJson, 'request.script.res');
if(responseScriptFile && responseScriptFile.length) {
const scriptRuntime = new ScriptRuntime();
scriptRuntime.runResponseScript(responseScriptFile, request, err.response, envVariables, collectionVariables, collectionPath);
await scriptRuntime.runResponseScript(responseScriptFile, request, err.response, envVariables, collectionVariables, collectionPath);
}
// run assertions