mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 17:33:28 +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,
|
brunoConfig,
|
||||||
collectionRoot
|
collectionRoot
|
||||||
);
|
);
|
||||||
|
({ collectionVariables, envVariables } = result);
|
||||||
|
|
||||||
results.push({
|
results.push({
|
||||||
...result,
|
...result,
|
||||||
|
@ -57,14 +57,14 @@ const runSingleRequest = async function (
|
|||||||
const preRequestVars = get(bruJson, 'request.vars.req');
|
const preRequestVars = get(bruJson, 'request.vars.req');
|
||||||
if (preRequestVars?.length) {
|
if (preRequestVars?.length) {
|
||||||
const varsRuntime = new VarsRuntime();
|
const varsRuntime = new VarsRuntime();
|
||||||
varsRuntime.runPreRequestVars(
|
({ collectionVariables } = varsRuntime.runPreRequestVars(
|
||||||
preRequestVars,
|
preRequestVars,
|
||||||
request,
|
request,
|
||||||
envVariables,
|
envVariables,
|
||||||
collectionVariables,
|
collectionVariables,
|
||||||
collectionPath,
|
collectionPath,
|
||||||
processEnvVars
|
processEnvVars
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// run pre request script
|
// run pre request script
|
||||||
@ -87,6 +87,7 @@ const runSingleRequest = async function (
|
|||||||
if (result?.nextRequestName !== undefined) {
|
if (result?.nextRequestName !== undefined) {
|
||||||
nextRequestName = result.nextRequestName;
|
nextRequestName = result.nextRequestName;
|
||||||
}
|
}
|
||||||
|
({ collectionVariables, envVariables } = result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpolate variables inside request
|
// interpolate variables inside request
|
||||||
@ -248,7 +249,7 @@ const runSingleRequest = async function (
|
|||||||
const postResponseVars = get(bruJson, 'request.vars.res');
|
const postResponseVars = get(bruJson, 'request.vars.res');
|
||||||
if (postResponseVars?.length) {
|
if (postResponseVars?.length) {
|
||||||
const varsRuntime = new VarsRuntime();
|
const varsRuntime = new VarsRuntime();
|
||||||
varsRuntime.runPostResponseVars(
|
({ collectionVariables, envVariables } = varsRuntime.runPostResponseVars(
|
||||||
postResponseVars,
|
postResponseVars,
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
@ -256,7 +257,7 @@ const runSingleRequest = async function (
|
|||||||
collectionVariables,
|
collectionVariables,
|
||||||
collectionPath,
|
collectionPath,
|
||||||
processEnvVars
|
processEnvVars
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// run post response script
|
// run post response script
|
||||||
@ -322,6 +323,7 @@ const runSingleRequest = async function (
|
|||||||
processEnvVars,
|
processEnvVars,
|
||||||
scriptingConfig
|
scriptingConfig
|
||||||
);
|
);
|
||||||
|
({ collectionVariables, envVariables } = result);
|
||||||
testResults = get(result, 'results', []);
|
testResults = get(result, 'results', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +357,9 @@ const runSingleRequest = async function (
|
|||||||
error: null,
|
error: null,
|
||||||
assertionResults,
|
assertionResults,
|
||||||
testResults,
|
testResults,
|
||||||
nextRequestName: nextRequestName
|
nextRequestName: nextRequestName,
|
||||||
|
collectionVariables,
|
||||||
|
envVariables
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(chalk.red(stripExtension(filename)) + chalk.dim(` (${err.message})`));
|
console.log(chalk.red(stripExtension(filename)) + chalk.dim(` (${err.message})`));
|
||||||
|
Loading…
Reference in New Issue
Block a user