16bugs JavaScript: from Zero to Hero
Log in

JavaScript: from Zero to Hero

#175 lesson on testing

Reported by Volkan Ozcelik · 14 Jul 2018, 06:54

Status
New
Priority
Normal
Assigned to
Volkan Ozcelik
Category
Lessons
Version
None

dump from slack

never written a test in my life, what should I use?

If you want something popular and getting traction try `jest` jestjs.io

Jest is based on `jasmine`, so if for some reason you like the syntax but it does not quite suit you you can try its elder sister https://jasmine.github.io/

mocha is pretty solid too. No problem using it. Especially Mocha + Chai + Sinon ( https://www.npmjs.com/package/mocha http://www.chaijs.com/ http://sinonjs.org/ ) combo goes long ways.

If you ask me, each test framework is a glorified facade over simpler `assert` functions. So more important than which framework to use is to get the mindset of TDD/BDD and think about “what” to test and “how” to test it, if/what to mock, how to design integration tests (along with unit tests); is testing UI an overkill that’s better delegated to selenium etc.

In short. Pick one popular framework and go for it.
All popular frameworks provide the same things: The only thing changes is their “flavor”, and also community support.

That said, I’d give `jest` a go ;)

History

14 Jul 2018, 06:54Volkan Ozcelik submitted the bug