fix(testrunner): fit.fail should run the test (#1407)

This commit is contained in:
Dmitry Gozman 2020-03-16 19:12:52 -07:00 committed by GitHub
parent aa32d351be
commit 3960b179a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -207,7 +207,7 @@ class TestWorker {
return;
}
if (test.expectation === TestExpectation.Fail) {
if (test.expectation === TestExpectation.Fail && test.declaredMode !== TestMode.Focus) {
await this._testPass._willStartTest(this, test);
test.result = TestResult.MarkedAsFailing;
await this._testPass._didFinishTest(this, test);

View File

@ -49,6 +49,15 @@ module.exports.addTests = function({testRunner, expect}) {
expect(test.fullName).toBe('uno');
expect(test.declaredMode).toBe('focus');
});
it('should run a failed focused test', async() => {
const t = newTestRunner();
let run = false;
t.fit.fail(true)('uno', () => { run = true; throw new Error('failure'); });
expect(t.tests().length).toBe(1);
await t.run();
expect(run).toBe(true);
expect(t.failedTests()[0].name).toBe('uno');
});
});
describe('TestRunner.describe', () => {