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

Use lab and Code for testing #215

Closed
AdrieanKhisbe opened this issue Jan 14, 2016 · 9 comments
Closed

Use lab and Code for testing #215

AdrieanKhisbe opened this issue Jan 14, 2016 · 9 comments

Comments

@AdrieanKhisbe
Copy link
Contributor

I'm proposing to migrate our testing to use labtest runner and code asserter.

Lab come with builtin coverage, beside on failing test doesnt terminate the testing. (hence you could detect several failing test. -> that was a pain pouring some es6 into metalsmith).

Code assertions are also more expressive, and capture more semantics.

I can take of this, should you agree :)

@Ajedi32
Copy link
Member

Ajedi32 commented Jan 14, 2016

on failing test doesn't terminate the testing

FYI, that's not default behavior for Mocha either. Here's the culprit: https://github.com/metalsmith/metalsmith/blob/master/test/mocha.opts#L4

If you want to submit a PR to remove that I'd personally be in favor of it.

@AdrieanKhisbe
Copy link
Contributor Author

incoming!!

@AdrieanKhisbe
Copy link
Contributor Author

(shall I do it in the #214 PR, or a dedicated?
if we consider that #214 will be merge, that will avoid us an extra merge commit)

@Ajedi32
Copy link
Member

Ajedi32 commented Jan 14, 2016

Make it in a separate PR. I want to double-check that no one else has any objections to removing that option before merging it, so it'd be good to have a separate PR to point people to.

@AdrieanKhisbe
Copy link
Contributor Author

Nopro!

@Ajedi32
Copy link
Member

Ajedi32 commented Jan 14, 2016

Regarding this proposal, I will say I'm a bit skeptical. Mocha is a pretty popular test framework with a large ecosystem and strong community support, and I'm not quite sure I see any huge benefits to switching to Lab.

Code looks pretty nice though, and I don't think I'd personally mind using that in our existing tests.

Although... one thing I did notice that Lab might give us is support for source maps in our test coverage. (Which we will probably want for #214). Istanbul is working on support for that, but it doesn't seem fully baked yet: gotwarlost/istanbul#212

@AdrieanKhisbe
Copy link
Contributor Author

I see your points.
The main difference between lab and mocha in term of dsl is that all it takes a function with a done callback.
Two benefits of lab is indeed the builtin coverage, and also the builtin linter (relint on .??hintrc)

I let you decide. There is no urgency, and it's just a suggetsion :)

@Ajedi32
Copy link
Member

Ajedi32 commented Jan 14, 2016

FYI, Mocha also supports a done callback for asynchronous tests. It also supports Promises, which is super-nice IMO. (You can return a promise from the test case, and the test will either fail or pass once the promise resolves.)

@AdrieanKhisbe
Copy link
Contributor Author

I knew for the async callback. But didn't know about the promise.
Thanks for this piece of information ;)

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

No branches or pull requests

2 participants