Skip to content

doc(proposal): suite-level hooks#25

Draft
JakobJingleheimer wants to merge 1 commit intomainfrom
proposal/suite-level-hooks
Draft

doc(proposal): suite-level hooks#25
JakobJingleheimer wants to merge 1 commit intomainfrom
proposal/suite-level-hooks

Conversation

@JakobJingleheimer
Copy link
Copy Markdown
Member

No description provided.

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 28, 2026

tap and tape have t.teardown which is like an "after" - but i'm not sure what the benefit of t.before(f) would be, since you can just f() directly.

@JakobJingleheimer
Copy link
Copy Markdown
Member Author

JakobJingleheimer commented Mar 28, 2026

what the benefit of t.before(f) would be, since you can just f() directly

I presume you mean you could do something like

it('whatever', () => {
  const mocks = f();
});

f() does consolidate the code but it lacks the orchestration (resetting mocks etc).

It also makes a very common need manually repeated.

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 28, 2026

I’m confused; there’s only one t per suite (subtests are a different one), so how would t.before(f) and f() be any different?

@JakobJingleheimer
Copy link
Copy Markdown
Member Author

Now I'm confused. Why are you talking about t.before?

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 28, 2026

Now that i understand the terms, this seems like a great idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants