Re:Show HN: Baretest – A Minimalistic Alternative to Jest
by tmikaeld on Saturday February 08, 2020 @03:59AM
(#22274805)
My use case is for Cloudflare Workers specifically, they have a max-size of 1MB per script and even while doing tests locally in node - the actual worker behave differently, so the only way to really test units is by adding the tests directly to the script. So you see the dilemma with that..
Re:Show HN: Baretest – A Minimalistic Alternative to Jest
by lmiller1990 on Friday February 07, 2020 @09:10PM
(#22273273)
I'm not this is really an alternative, at least a direct alternative, to Jest. Jest is much larger - but you get a LOT more functionality, so this isn't really surprising. You don't just get a test runner, you can a fully fledged testing environment.
I haven't found Jest to be a bottleneck at all, but all the other stuff (transpiling TS, rendering a DOM for React component tests, etc...). Jest supports all this out of the box, more or less, or with a few plugins - baretest doesn't. I guess you have to configure external libraries (jsdom, webpack, babel?) to do this with baretest. Now your tests are slow, like in Jest! Turns out the test runner isn't the bottleneck, but all the other stuff that happens before the actual execution.
Some real benchmarks would make this article much more convincing - and not just with a basic "sum" function, but various examples (some simple node tests, some API tests, some jsdom tests...)
I don't think baretest or minimalist libraries are bad, but I also don't think anyone using Jest could really consider this an alternative, unless your use case is very simple.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest
by volument on Friday February 07, 2020 @11:30PM
(#22273881)
Good points. Just want to point out that comparing with a basic "sum" function measures the performance of the test runner and leaves out the time it takes to run the application code. Baretest has little overhead so it is good for testing the actively developed code with the `only` function.
With Baretest all the custom things you do like transpiling TS or rendering React is done outside the test runner. This way it can test cases of any complexity.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest
by lmiller1990 on Saturday February 08, 2020 @07:20AM
(#22275381)
In that case, will this really cut down on time to see the test result? Won't I have to trigger my TS/React build, then run the test (two separate actions, difficult to automate this).
Again, I like simple... but it seems like to move from Jest to baretest I'd be giving up a lot, in terms of both features and time from saving my file to seeing the test result.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest
by volument on Friday February 07, 2020 @11:38PM
(#22273912)
True. However, according to "The State of JavaScript" [1] Jest is the most popular option these days and it is chosen because it is simple, lightweight, fast, and easy [2] — all of which are the reasons one would choose Baretest.
Does it work when minified, or does it need node?
(By the way, you should probably not require an account to be on your waiting list)
And yes. Bareserver needs Node currently and is not designed for client-side testing. It's trivial to add if needed.
Made it more clear that account is not needed and email is enough. Thanks!
Jesus. Didn't know it is _that_ big.
I haven't found Jest to be a bottleneck at all, but all the other stuff (transpiling TS, rendering a DOM for React component tests, etc...). Jest supports all this out of the box, more or less, or with a few plugins - baretest doesn't. I guess you have to configure external libraries (jsdom, webpack, babel?) to do this with baretest. Now your tests are slow, like in Jest! Turns out the test runner isn't the bottleneck, but all the other stuff that happens before the actual execution.
Some real benchmarks would make this article much more convincing - and not just with a basic "sum" function, but various examples (some simple node tests, some API tests, some jsdom tests...)
I don't think baretest or minimalist libraries are bad, but I also don't think anyone using Jest could really consider this an alternative, unless your use case is very simple.
With Baretest all the custom things you do like transpiling TS or rendering React is done outside the test runner. This way it can test cases of any complexity.
Again, I like simple... but it seems like to move from Jest to baretest I'd be giving up a lot, in terms of both features and time from saving my file to seeing the test result.
[1]: https://2019.stateofjs.com/testing/
[2]: https://2018.stateofjs.com/testing/jest/