News for hackers. Stuff that matters.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest by tmikaeld on Saturday February 08, 2020 @02:06AM (#22274431)
This is actually something I've been looking for, to be able to test script size constrained serverless scripts!

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)

Re:Show HN: Baretest – A Minimalistic Alternative to Jest by volument on Saturday February 08, 2020 @02:19AM (#22274476)
Great to hear! Can you shed some light on "script size constrained serverless scripts"? Would possibly make a good FAQ entry.

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!

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 usually_wrong on Friday February 07, 2020 @12:00AM (#22263367)
> Jest is 57,540 lines of TypeScript

Jesus. Didn't know it is _that_ big.

Re:Show HN: Baretest – A Minimalistic Alternative to Jest by lmiller1990 on Friday February 07, 2020 @08:50PM (#22273166)
Considering the huge amount of features, and the LOC added for type definitions etc (when compared to regular JS) it isn't that surprising.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest by fuzzymind on Saturday February 08, 2020 @02:48AM (#22274574)
I wouldn't be surprised to see a test runner with the same features done in 1000–5000 lines.
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 jessaustin on Friday February 07, 2020 @10:40PM (#22273664)
I doubt that most users of complicated test tools are using most of the features of those tools.
Re:Show HN: Baretest – A Minimalistic Alternative to Jest by k__ on Friday February 07, 2020 @09:23PM (#22273355)
Seems more like an alternative for Tape to me.
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.

[1]: https://2019.stateofjs.com/testing/

[2]: https://2018.stateofjs.com/testing/jest/