dwyl / learn-tape

:white_check_mark: Learn how to use Tape for JavaScript/Node.js Test Driven Development (TDD) - Ten-Minute Testing Tutorial
187 stars 31 forks source link

Discussion of why we use tape. #1

Closed nelsonic closed 5 years ago

nelsonic commented 8 years ago

further discussion of "which testing framework" in #tl;dr section.

ghost commented 8 years ago

@nelsonic I was reading or trying to read the readme regarding learning tap, and just now too much Mocha stuff, but it looks awsome!

And I agree that Tape is awsome, and what you listed above is a good start. However, let me try to help you out...

If you compare Tape with Mocha or Jasmine you will notice that both of them are using global environment pollution aka Describe() and It(). And Mocha CLI is required, directly running a mocha test files fails. Jasmine doesn't have a test runner and can't be run on NodeJS.

With AVA. CLI is required, so directly running a test files fails. Ava's stack trace interpreter often removes helpful information, accesses properties on your object (causing side effects), and can interfere with other libraries built in error reporting (ie. Long Stack Traces)

Hope that helps? Both Mocha and Tape does run all tests serially (one at a time). AVA doesn't. I prefer concurrent tests, but not the way AVA does it. Forking the child-process causes more pain regarding debugging then everything else.

If you look at the down sides of using Tape is the lack of Promises. You have Blue Tape, but Mocha has it build in. AVA have it build in.

In Tape also the number of assertions has to be manually counted and planned (t.plan()) for every test. That isn't needed anymore ano 2016. See Blue Tape.

Hope I gave you some help. Anyway. Personally I'm a Tape fan. I don't like AVA out of many reasons, and same for Mocha. Things has to be simple.

I figured this all out when I did a deep study of all testing frameworks and TDD solutions before I developed my own !

nelsonic commented 8 years ago

@crazyhuggins agree. Tape is the simplest test runner we have found (so far...) 👍 We are using t.end() in our asynchronous tests instead of t.plan() for people needing promise support blue tape is a good option.

ghost commented 8 years ago

@nelsonic .t.end() shouldn't be needed for asynchronous tests either. In my opinion it complicate things. If you look at how Mocha does it with the done() callback. But both Tape and Mocha have issues with done(). Regarding promise support, it should be optional included in the source for people who needs it.

I forgot too mention the hooks Tape has. That is another reason to use Tape. In AVA the Hooks does to much magic.

Read this article: https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4#.r86gh65cu

nelsonic commented 8 years ago
kflash-removed-comment

@Kflash https://www.npmjs.com/package/candeza looks v. promising! Please keep us informed when you decide to make the source available. 👍 We are using Tape in a lot (over 100) of projects hence this repo/discussion ... Always willing to try a new test runner if it fits with our needs.

ghost commented 8 years ago

@nelsonic I accidently removed the post when I only should remove the link earlier. Because it's not public yet. Sure I will keep you informed soon as I get things worked out.

The runner I linked too does exactly the same as Tape, but with a lot of things done better. I saw your GH log, and the things you are struggling with regarding Tape is one of many things allready solved.

I need to settle on an API now and add a watch task for the CLI. But my days are scheduled so little time to work on this and the extra pair of eyes I would need isn't there atm.

Anyway. I will keep you informed!

update @nelsonic I landed on a API similar to Tape. Updated NPM. The runner is stable enough to be used, and some docs are published. Source is not out yet.

ghost commented 8 years ago

@nelsonic I was looking through all repos in the dwyl organization and tried to study how you was using Tape so I could come up with a better runner after learning your use case.

This is out of topic maybe, but how are you using Tape's hooks? In comparison with AVA and Mocha / Jasmine, Tape's hooks are better just to mention that. No context or global state.

nelsonic commented 8 years ago

@Kflash don't worry about sharing links to "private" projects... sometimes sharing your work early can lead to finding collaborators and can motivate you to dedicate more time to getting the work done faster. 😉

I'd encourage you to write a list of the features that you are doing better than Tape or have a little comparison table.

As for Tape's hooks only using onFinish. 👍

ghost commented 8 years ago

@nelsonic I allways have issues to share uncomplete stuff. I got everything documented. I can send you a link if you have a GitLab account

nelsonic commented 8 years ago

@Kflash my GitLab account name is the same as GitHub. 😉

nelsonic commented 5 years ago

Captured in readme. ✅