Skip to content

Commit

Permalink
Allow bru.setNextRequest() on Test Scripts (#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
BruAlcarazUlg committed Jul 10, 2024
1 parent bd61e45 commit b25141c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/bruno-cli/src/runner/run-single-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ const runSingleRequest = async function (
scriptingConfig
);
testResults = get(result, 'results', []);

if (result?.nextRequestName !== undefined) {
nextRequestName = result.nextRequestName;
}
}

if (testResults?.length) {
Expand Down
4 changes: 4 additions & 0 deletions packages/bruno-electron/src/ipc/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,10 @@ const registerNetworkIpc = (mainWindow) => {
scriptingConfig
);

if (testResults?.nextRequestName !== undefined) {
nextRequestName = testResults.nextRequestName;
}

mainWindow.webContents.send('main:run-folder-event', {
type: 'test-results',
testResults: testResults.results,
Expand Down
6 changes: 4 additions & 2 deletions packages/bruno-js/src/runtime/test-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class TestRuntime {
request,
envVariables,
collectionVariables,
results: __brunoTestResults.getResults()
results: __brunoTestResults.getResults(),
nextRequestName: bru.nextRequest
};
}

Expand Down Expand Up @@ -147,7 +148,8 @@ class TestRuntime {
request,
envVariables: cleanJson(envVariables),
collectionVariables: cleanJson(collectionVariables),
results: cleanJson(__brunoTestResults.getResults())
results: cleanJson(__brunoTestResults.getResults()),
nextRequestName: bru.nextRequest
};
}
}
Expand Down

0 comments on commit b25141c

Please sign in to comment.