forked from extern/bruno
feat: bru.setNextRequest(null) breaks execution without error
This commit is contained in:
parent
129d659628
commit
8183ce03c5
@ -371,13 +371,19 @@ const handler = async function (argv) {
|
||||
collectionRoot
|
||||
);
|
||||
|
||||
results.push(result);
|
||||
|
||||
// determine next request
|
||||
const nextRequestName = result?.nextRequestName;
|
||||
if (nextRequestName) {
|
||||
if (nextRequestName !== undefined) {
|
||||
nJumps++;
|
||||
if (nJumps > 10000) {
|
||||
console.error(chalk.red(`Too many jumps, possible infinite loop`));
|
||||
process.exit(1);
|
||||
}
|
||||
if (nextRequestName === null) {
|
||||
break;
|
||||
}
|
||||
const nextRequestIdx = bruJsons.findIndex((iter) => iter.bruJson.name === nextRequestName);
|
||||
if (nextRequestIdx >= 0) {
|
||||
currentRequestIndex = nextRequestIdx;
|
||||
@ -388,8 +394,6 @@ const handler = async function (argv) {
|
||||
} else {
|
||||
currentRequestIndex++;
|
||||
}
|
||||
|
||||
results.push(result);
|
||||
}
|
||||
|
||||
const summary = printRunSummary(results);
|
||||
|
@ -77,7 +77,7 @@ const runSingleRequest = async function (
|
||||
processEnvVars,
|
||||
scriptingConfig
|
||||
);
|
||||
if (result?.nextRequestName) {
|
||||
if (result?.nextRequestName !== undefined) {
|
||||
nextRequestName = result.nextRequestName;
|
||||
}
|
||||
}
|
||||
@ -252,7 +252,7 @@ const runSingleRequest = async function (
|
||||
processEnvVars,
|
||||
scriptingConfig
|
||||
);
|
||||
if (result?.nextRequestName) {
|
||||
if (result?.nextRequestName !== undefined) {
|
||||
nextRequestName = result.nextRequestName;
|
||||
}
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
scriptingConfig
|
||||
);
|
||||
|
||||
if (preRequestScriptResult?.nextRequestName) {
|
||||
if (preRequestScriptResult?.nextRequestName !== undefined) {
|
||||
nextRequestName = preRequestScriptResult.nextRequestName;
|
||||
}
|
||||
|
||||
@ -802,7 +802,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
scriptingConfig
|
||||
);
|
||||
|
||||
if (postRequestScriptResult?.nextRequestName) {
|
||||
if (postRequestScriptResult?.nextRequestName !== undefined) {
|
||||
nextRequestName = postRequestScriptResult.nextRequestName;
|
||||
}
|
||||
|
||||
@ -866,11 +866,14 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
...eventData
|
||||
});
|
||||
}
|
||||
if (nextRequestName) {
|
||||
if (nextRequestName !== undefined) {
|
||||
nJumps++;
|
||||
if (nJumps > 10000) {
|
||||
throw new Error('Too many jumps, possible infinite loop');
|
||||
}
|
||||
if (nextRequestName === null) {
|
||||
break;
|
||||
}
|
||||
const nextRequestIdx = folderRequests.findIndex((request) => request.name === nextRequestName);
|
||||
if (nextRequestIdx >= 0) {
|
||||
currentRequestIndex = nextRequestIdx;
|
||||
|
Loading…
Reference in New Issue
Block a user