mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
When running via CLI, preserve changes to collection variables and
environment variables. Closes #1255
This commit is contained in:
parent
9320b8faf0
commit
7c94c9ec19
@ -422,6 +422,7 @@ const handler = async function (argv) {
|
||||
brunoConfig,
|
||||
collectionRoot
|
||||
);
|
||||
({ collectionVariables, envVariables } = result);
|
||||
|
||||
results.push({
|
||||
...result,
|
||||
|
@ -57,14 +57,14 @@ const runSingleRequest = async function (
|
||||
const preRequestVars = get(bruJson, 'request.vars.req');
|
||||
if (preRequestVars?.length) {
|
||||
const varsRuntime = new VarsRuntime();
|
||||
varsRuntime.runPreRequestVars(
|
||||
({ collectionVariables } = varsRuntime.runPreRequestVars(
|
||||
preRequestVars,
|
||||
request,
|
||||
envVariables,
|
||||
collectionVariables,
|
||||
collectionPath,
|
||||
processEnvVars
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
// run pre request script
|
||||
@ -87,6 +87,7 @@ const runSingleRequest = async function (
|
||||
if (result?.nextRequestName !== undefined) {
|
||||
nextRequestName = result.nextRequestName;
|
||||
}
|
||||
({ collectionVariables, envVariables } = result);
|
||||
}
|
||||
|
||||
// interpolate variables inside request
|
||||
@ -248,7 +249,7 @@ const runSingleRequest = async function (
|
||||
const postResponseVars = get(bruJson, 'request.vars.res');
|
||||
if (postResponseVars?.length) {
|
||||
const varsRuntime = new VarsRuntime();
|
||||
varsRuntime.runPostResponseVars(
|
||||
({ collectionVariables, envVariables } = varsRuntime.runPostResponseVars(
|
||||
postResponseVars,
|
||||
request,
|
||||
response,
|
||||
@ -256,7 +257,7 @@ const runSingleRequest = async function (
|
||||
collectionVariables,
|
||||
collectionPath,
|
||||
processEnvVars
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
// run post response script
|
||||
@ -322,6 +323,7 @@ const runSingleRequest = async function (
|
||||
processEnvVars,
|
||||
scriptingConfig
|
||||
);
|
||||
({ collectionVariables, envVariables } = result);
|
||||
testResults = get(result, 'results', []);
|
||||
}
|
||||
|
||||
@ -355,7 +357,9 @@ const runSingleRequest = async function (
|
||||
error: null,
|
||||
assertionResults,
|
||||
testResults,
|
||||
nextRequestName: nextRequestName
|
||||
nextRequestName: nextRequestName,
|
||||
collectionVariables,
|
||||
envVariables
|
||||
};
|
||||
} catch (err) {
|
||||
console.log(chalk.red(stripExtension(filename)) + chalk.dim(` (${err.message})`));
|
||||
|
Loading…
Reference in New Issue
Block a user