test_runner: improve describe.only behavior#52296
Merged
nodejs-github-bot merged 3 commits intonodejs:mainfrom Apr 2, 2024
Merged
test_runner: improve describe.only behavior#52296nodejs-github-bot merged 3 commits intonodejs:mainfrom
nodejs-github-bot merged 3 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Member
Author
|
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 |
cjihrig
approved these changes
Mar 31, 2024
Contributor
cjihrig
left a comment
There was a problem hiding this comment.
LGTM, but it's probably worth updating some docs for this.
benjamingr
approved these changes
Apr 1, 2024
atlowChemi
reviewed
Apr 1, 2024
atlowChemi
approved these changes
Apr 1, 2024
atlowChemi
approved these changes
Apr 1, 2024
cjihrig
approved these changes
Apr 1, 2024
Collaborator
Collaborator
atlowChemi
approved these changes
Apr 1, 2024
Collaborator
trivikr
approved these changes
Apr 2, 2024
rluvaton
reviewed
Apr 2, 2024
Member
rluvaton
left a comment
There was a problem hiding this comment.
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
Member
Author
|
@rluvaton can you add these tests in a follow-up PR?. I am not sure what an unfocused suite is |
Member
|
sure (what I meant with unfocused are suites that or not in the only scope) |
Member
Author
|
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 |
Collaborator
|
Landed in ac9e5e7 |
Member
|
Can you please create a manual backport to v20x? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #48932
this fixes two major issues with
describethat will now run regardless of it not being marked withonly:onlyonly, and no nested test is marked withonly, all its decendents will runthis aligns the behavior with other test runners I have compared with