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

refactor(major): reimplement, smaller & faster #15

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

tunnckoCore
Copy link
Owner

@tunnckoCore tunnckoCore commented Nov 23, 2018

I don't know why, but from time to time, I sit and write test / task runners. 🤣

Always trying different ways, different approach, smallest possible implementation and so on. This time, I just realized that 60 lines of code are enough and pretty useful and stable and extensible. As always, code comments for docs are 3-4 times more than the actual code.

I'm back to the idea that we don't need CLI. And it makes sense to be a separate thing. What's the most common case? You write a small library with one test file, in most of the time. You literally don't need transpiling, workers, tons of useless dependencies.

If you need to be fancy and use ES Modules everywhere and your target Node.js version is at least v8.10+, then you can just use the esm loader passed to the node executable. In case you want Babel or TypeScript, you still and currently can do it: just pass the require hook to node binary when running the tests, and to the require hook of nyc (not to the node binary) when running test coverage.

But it should be simple, small, fast and enough. Basic & TAP Spec coompliant repoter and let users choose whatever they want.

This time the main purpose was to totally minimize the usage of node built-in modules and whatnot, so to be compatible with the browser. And yes, it works there.

In bonus, just for the fun and profit, I decided to bundle it, so installation times are zero seconds. It was around 18kb as a whole and 6kb minified.

The good and the bad thing is that it not include assertion api - you can choose whatever you want, it works well with both the builtin assert and Jest's expect. There are Pros and Cons about that, but for now we will go that way, at least until I create the small and awesome azy assertion library that will work well with every testing framework.

In future there will be a CLI, of course. But it will be just for more advanced users and more bigger projects.

@tunnckoCore tunnckoCore changed the title v1 [major]: reimplement, smaller & faster refactor(major): reimplement, smaller & faster Nov 23, 2018
@codecov
Copy link

codecov bot commented Nov 23, 2018

Codecov Report

Merging #15 into master will increase coverage by 12.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #15       +/-   ##
=========================================
+ Coverage    87.8%   100%   +12.19%     
=========================================
  Files           2      4        +2     
  Lines         164    122       -42     
=========================================
- Hits          144    122       -22     
+ Misses         20      0       -20
Impacted Files Coverage Δ
src/api.js 100% <100%> (ø) ⬆️
src/index.js 100% <100%> (ø)
src/utils.js 100% <100%> (+26.31%) ⬆️
src/reporters/tap.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4f32cf...e37fc18. Read the comment docs.

Charlike Mike Reagent added 12 commits November 23, 2018 18:51
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
@tunnckoCore
Copy link
Owner Author

TODO: reporters are not accessible.

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 this pull request may close these issues.

1 participant