Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overloaded form of unit test declaration: test(name, fn) #562

Closed
ry opened this issue Aug 14, 2019 · 1 comment · Fixed by #563
Closed

Add overloaded form of unit test declaration: test(name, fn) #562

ry opened this issue Aug 14, 2019 · 1 comment · Fixed by #563

Comments

@ry
Copy link
Member

ry commented Aug 14, 2019

There are currently two ways to declare a unit test

// original form
test(function foo() { assert(true); });
// expanded form
test({ name: "foo", fn: () => { assert(true); });

It turns out that many of the tests in deno_std are using the expanded form. We could shorten this significantly by also allowing

test( "foo", () => { assert(true); });

Someone has suggested this before and noted that a certain existing test framework uses this form as well. (I can't find a reference.) So that's another reason to change.

Edit: reportedly Ava.js, Mocha and Jest all support this.

@sholladay
Copy link

I suggested it in #93.

More specifically, I think AVA's API should be adopted, for at least test definitions and assertions.

inverted-capital pushed a commit to dreamcatcher-tech/napps that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants