-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
test_runner: improve describe.only behavior #52296
Conversation
Review requested:
|
some examples: describe('1', () => {
it('2');
describe('3', () => {
it('4');
describe('5', () => {
it('6');
it.only('7');
});
});
}); ===>
describe('1', () => {
it('2');
describe.only('3', () => {
it('4');
describe('5', () => {
it('6');
it('7');
});
});
}); ===>
etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it's probably worth updating some docs for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that before
and after
hooks are not running for unfocused suites? IIRC they do run when there are no tests in describe while I think they shouldn't in this case
@rluvaton can you add these tests in a follow-up PR?. I am not sure what an unfocused suite is |
sure (what I meant with unfocused are suites that or not in the only scope) |
FWIW this code describe('describe 1', () => {
before(() => console.log('before describe 1'))
beforeEach(() => console.log('beforeEach describe 1'))
it.only(async () => {
console.log(1);
})
it('no', () => {});
afterEach(() => console.log('afterEach describe 1'))
after(() => console.log('after describe 1'))
})
describe('describe 2', () => {
before(() => console.log('before describe 2'))
beforeEach(() => console.log('beforeEach describe 2'))
it('no', () => {});
afterEach(() => console.log('afterEach describe 2'))
after(() => console.log('after describe 2'))
}) outputs
which seems ok to me |
Landed in ac9e5e7 |
Can you please create a manual backport to v20x? |
Supersedes #48932
this fixes two major issues with
describe
that will now run regardless of it not being marked withonly
:only
only
, and no nested test is marked withonly
, all its decendents will runthis aligns the behavior with other test runners I have compared with