Skip to content

test_runner: fix ordering of test hooks - #47931

Merged
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
philnash:before-before-beforeeach
May 11, 2023
Merged

test_runner: fix ordering of test hooks#47931
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
philnash:before-before-beforeeach

Conversation

@philnash

Copy link
Copy Markdown
Contributor

For tests with subtests the before hook was being run after the beforeEach hook, which is the opposite to test suites and expectations.

Also, a function was being used to close over the after hooks, but at the point it was being run the after hooks were not yet set up.

Fixes#47915

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels May 9, 2023
Comment threadlib/internal/test_runner/test.js Outdated
@MoLow

MoLow commented May 9, 2023

Copy link
Copy Markdown
Member

please amend the commit message from test: fix ordering of test hooks to test_runner: fix ordering of test hooks

For tests with subtests the before hook was being run after the
beforeEach hook, which is the opposite to test suites and expectations.
Also, a function was being used to close over the after hooks, but at
the point it was being run the after hooks were not yet set up.
Fixesnodejs#47915
@philnash
philnashforce-pushed the before-before-beforeeach branch from f08f31f to 3ae2015CompareMay 9, 2023 09:45
@philnashphilnash changed the title test: fix ordering of test hookstest_runner: fix ordering of test hooksMay 9, 2023
@philnash

Copy link
Copy Markdown
ContributorAuthor

I've updated the commit message. Thanks for the review.

@MoLowMoLow added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels May 10, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 10, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@philnash

Copy link
Copy Markdown
ContributorAuthor

I can see that some of the Jenkins jobs are failing. Though I'm not sure why. Is there anything I can do to help this?

@MoLow

Copy link
Copy Markdown
Member

I can see that some of the Jenkins jobs are failing. Though I'm not sure why. Is there anything I can do to help this?

that is not related to this PR, unfortunately there are some flaky tests

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@philnash

Copy link
Copy Markdown
ContributorAuthor

that is not related to this PR, unfortunately there are some flaky tests

Ah, fair enough. Thank you!

@MoLow
MoLow requested a review from cjihrigMay 10, 2023 14:25
Comment threadlib/internal/test_runner/test.js
Comment threadlib/internal/test_runner/test.js
@MoLowMoLow added the request-ci Add this label to start a Jenkins CI on a PR. label May 11, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 11, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MoLowMoLow added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 11, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 11, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 24615bd into nodejs:mainMay 11, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 24615bd

@MoLow

Copy link
Copy Markdown
Member

Thanks for the contribution @philnash 🎉

@philnash

Copy link
Copy Markdown
ContributorAuthor

Thanks for the help getting this in @MoLow!

targos pushed a commit that referenced this pull request May 12, 2023
For tests with subtests the before hook was being run after the
beforeEach hook, which is the opposite to test suites and expectations.
Also, a function was being used to close over the after hooks, but at
the point it was being run the after hooks were not yet set up.
Fixes#47915
PR-URL: #47931
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@targostargos mentioned this pull request May 15, 2023
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
For tests with subtests the before hook was being run after the
beforeEach hook, which is the opposite to test suites and expectations.
Also, a function was being used to close over the after hooks, but at
the point it was being run the after hooks were not yet set up.
Fixes#47915
PR-URL: #47931
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
For tests with subtests the before hook was being run after the
beforeEach hook, which is the opposite to test suites and expectations.
Also, a function was being used to close over the after hooks, but at
the point it was being run the after hooks were not yet set up.
Fixesnodejs#47915
PR-URL: nodejs#47931
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.needs-ciPRs that need a full CI run.test_runnerIssues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of test hooks seems wrong, and is different to the order of hooks for a describe suite

4 participants

@philnash@nodejs-github-bot@MoLow@cjihrig