Skip to content

How can I run the same tests twice (or more) but with one thing different #2800

Answered by novemberborn
fregante asked this question in Q&A
Discussion options

You must be logged in to vote

I would use a macro:

const checkIdentity = (t, fn) => {
  t.is(fn(555), 555)
}

checkIdentity.title = (title, fn) => `${title || ''} ${fn.name}`

test('base', checkIdentity, identity1)
test('base', checkIdentity, identity2)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fregante
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants