Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .verify swallows custom assertion initialization errors #4153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 27 additions & 27 deletions lib/testsuite/index.js
Expand Up @@ -836,38 +836,38 @@ class TestSuite {
testcase: this.reporter.testResults.currentTestName
});

return this.handleRunnable(this.testcase.testName, () => this.testcase.run(this.client));
})
.catch(err => {
return err;
})
.then(possibleError => {
this.client.reporter.unmarkHookRun();
this.handleRunnable(this.testcase.testName, () => this.testcase.run(this.client)).then(async possibleError => {
this.client.reporter.unmarkHookRun();

NightwatchEventHub.emit(TestSuiteHook.test.finished, {
...this.reporter.testResults.eventDataToEmit,
testcase: this.reporter.testResults.currentTestName
});
NightwatchEventHub.emit(TestSuiteHook.test.finished, {
...this.reporter.testResults.eventDataToEmit,
testcase: this.reporter.testResults.currentTestName
});

if (this.transport.driverService && this.reporter.testResults) {
this.reporter.testResults.setSeleniumLogFile(this.transport.driverService.getSeleniumOutputFilePath());
}
if (this.transport.driverService && this.reporter.testResults) {
this.reporter.testResults.setSeleniumLogFile(this.transport.driverService.getSeleniumOutputFilePath());
}

// if there was an error in the testcase and skip_testcases_on_fail, we must send it forward, but after we run afterEach and after hooks
return this.runHook('afterEach')
.then(() => this.testCaseFinished())
.then(() => possibleError);
})
.then(possibleError => {
if (this.shouldRetryTestCase()) {
return this.retryCurrentTestCase();
}
// if there was an error in the testcase and skip_testcases_on_fail, we must send it forward, but after we run afterEach and after hooks
await this.runHook('afterEach');
this.testCaseFinished();

if ((possibleError instanceof Error) && this.shouldSkipTestsOnFail()) {
throw possibleError;
}
return possibleError;
})
.then(possibleError => {

return this.runNextTestCase();
if (this.shouldRetryTestCase()) {
return this.retryCurrentTestCase();
}

if ((possibleError instanceof Error) && this.shouldSkipTestsOnFail()) {
throw possibleError;
}

return this.runNextTestCase();
}).catch(err => {
return err;
});
});
}

Expand Down