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

Migrate form Tape to Tap (Run Tests in PARALLEL!) ? #34

Closed
5 tasks
nelsonic opened this issue Aug 8, 2018 · 8 comments
Closed
5 tasks

Migrate form Tape to Tap (Run Tests in PARALLEL!) ? #34

nelsonic opened this issue Aug 8, 2018 · 8 comments

Comments

@nelsonic
Copy link
Member

nelsonic commented Aug 8, 2018

Why?

It recently came to our attention in: dwyl/aws-sdk-mock#144
image
that tap has a couple of really useful features that tape (our current test runner) does not.

We use tape virtually everywhere in our Node.js projects (hence this tutorial)
And in general it works really well for us.
e.g: https://travis-ci.org/dwyl/hapi-auth-jwt2/jobs/376314561
image
The npm test stage take "only" 5.25 seconds to complete,
which means is't never been a "problem" for us ...

However on bigger Node.js project(s) with many tests e.g: https://github.com/TheScienceMuseum/collectionsonline
https://travis-ci.org/TheScienceMuseum/collectionsonline/builds/409777564#L576
image
There could be a pretty significant benefit to running tests in Parallel.

What?

How?

The steps are pretty simple as outlined in:
https://github.com/dwyl/aws-sdk-mock/pull/144/files#diff-0fd0e07cf6d02bf7cf00f18cebb8e6eaR1

We could also include a mini-guide at the end for "how to migrate from Tape to Tap" based on our experience of doing it for a sample project
e.g: https://www.npmjs.com/package/hapi-auth-jwt2 or https://www.npmjs.com/package/decache
both of which can use a devDependencies update ... 🙄

Todo:

@nelsonic nelsonic changed the title Migrate form Tape to Tap? Migrate form Tape to Tap (for PARALLEL Test Execution) ...? Aug 8, 2018
@nelsonic nelsonic changed the title Migrate form Tape to Tap (for PARALLEL Test Execution) ...? Migrate form Tape to Tap (Run Tests in PARALLEL!) ? Aug 8, 2018
@nelsonic
Copy link
Member Author

One of the most useful/important features that Tap has which Tape does not
is t.beforeEach(function (done) {}) and t.afterEach(function (done) {})
see: https://www.node-tap.org/api/
image

in a recent example I've been working on: https://github.com/dwyl/learn-elm-architecture-in-javascript
The "reset" code takes up 6% of the file and has been the cause of frustration!!
/test/todo-app.test.js#L667-L668

  elmish.empty(document.getElementById(id));
  localStorage.removeItem('todos-elmish_' + id);

e.g:
image

Simply moving to Tap will mean that we have a single t.afterEach to reset the state,
so that we can have simpler tests that always work and are easier to read/maintain.

@nelsonic
Copy link
Member Author

Proposed Analogy: Single Speed Bike vs. Specialized Racer (With Gears)
specialised-racing-bicycle
sku-fixie-single-speed-bike

Which one would you say is Tape and which is Tap (so we can test the analogy...)

@nelsonic
Copy link
Member Author

Perhaps the best "feature" of Tap is Code Coverage integration!
https://www.node-tap.org/coverage
image

@nelsonic
Copy link
Member Author

I'm applying a P2 label to this story because I need to use Tap for https://github.com/dwyl/atm
which is a priority for CS, Home and the dwyl website.

@nelsonic nelsonic moved this from To do to In progress in Nelson's List Oct 15, 2018
@nelsonic nelsonic moved this from In progress to To do in Nelson's List Oct 16, 2018
@nelsonic nelsonic moved this from To do to In progress in Nelson's List Oct 17, 2018
@nelsonic
Copy link
Member Author

image

@nelsonic
Copy link
Member Author

Reduced image size by 70% to respect people on lower bandwidth:
sku-fixie-single-speed-bike
specialised-racing-bicycle

Effect is the same when viewed on GitHub. #LittleThings 😉

@nelsonic
Copy link
Member Author

In the end I decided to simply extend the learn-tape tutorial to cover Tap
and explain the reasoning why someone would want to use Tap instead of Tape with a clear use-case example. ✅

@nelsonic nelsonic moved this from To do to Done in Nelson's List Oct 30, 2018
iteles added a commit that referenced this issue Nov 1, 2018
@nelsonic
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Nelson's List
  
Done
Development

No branches or pull requests

1 participant