test_runner: fix ordering of test hooks by philnash · Pull Request #47931 · nodejs/node

@nodejs-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

MoLow

@philnash

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 nodejs#47915

@philnash philnash changed the title test: fix ordering of test hooks test_runner: fix ordering of test hooks

May 9, 2023

@philnash

@MoLow MoLow 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

cjihrig

@philnash

@MoLow MoLow 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

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>

This was referenced

May 13, 2023

This was referenced

May 16, 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.

Fixes nodejs#47915

PR-URL: nodejs#47931
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>