mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-21 12:33:34 +02:00
fix: fixed issue where unsaved changes where not being picked up while running tests (#125)
This commit is contained in:
parent
bdb3051c2b
commit
d346970241
@ -179,17 +179,15 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// run tests
|
// run tests
|
||||||
const testFile = get(item, 'request.tests');
|
const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests');
|
||||||
if(testFile && testFile.length) {
|
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const result = testRuntime.runTests(testFile, request, response, envVars, collectionVariables, collectionPath);
|
const testResults = testRuntime.runTests(testFile, request, response, envVars, collectionVariables, collectionPath);
|
||||||
|
|
||||||
mainWindow.webContents.send('main:test-results', {
|
mainWindow.webContents.send('main:test-results', {
|
||||||
results: result.results,
|
results: testResults.results,
|
||||||
itemUid: item.uid,
|
itemUid: item.uid,
|
||||||
collectionUid
|
collectionUid
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
deleteCancelToken(cancelTokenUid);
|
deleteCancelToken(cancelTokenUid);
|
||||||
|
|
||||||
@ -407,17 +405,15 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// run tests
|
// run tests
|
||||||
const testFile = get(item, 'request.tests');
|
const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests');
|
||||||
if(testFile && testFile.length) {
|
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const result = testRuntime.runTests(testFile, request, response, envVars, collectionVariables, collectionPath);
|
const testResults = testRuntime.runTests(testFile, request, response, envVars, collectionVariables, collectionPath);
|
||||||
|
|
||||||
mainWindow.webContents.send('main:run-folder-event', {
|
mainWindow.webContents.send('main:run-folder-event', {
|
||||||
type: 'test-results',
|
type: 'test-results',
|
||||||
testResults: result.results,
|
testResults: testResults.results,
|
||||||
...eventData
|
...eventData
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.webContents.send('main:run-folder-event', {
|
mainWindow.webContents.send('main:run-folder-event', {
|
||||||
type: 'response-received',
|
type: 'response-received',
|
||||||
|
@ -28,6 +28,15 @@ class TestRuntime {
|
|||||||
const __brunoTestResults = new TestResults();
|
const __brunoTestResults = new TestResults();
|
||||||
const test = Test(__brunoTestResults, chai);
|
const test = Test(__brunoTestResults, chai);
|
||||||
|
|
||||||
|
if(!testsFile || !testsFile.length) {
|
||||||
|
return {
|
||||||
|
request,
|
||||||
|
envVariables,
|
||||||
|
collectionVariables,
|
||||||
|
results: __brunoTestResults.getResults()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const context = {
|
const context = {
|
||||||
test,
|
test,
|
||||||
bru,
|
bru,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user