Closed Leonardo-Rocha closed 4 years ago
Hi @Leonardo-Rocha, the scope of this particular project is purely around the superoak()
utility to make it easier to integration test Oak applications, so this isn’t something I plan to implement here.
I appreciate that testing Deno applications as a whole isn’t very mature atm with no existing testing library currently listed in the third party modules, and this is a pain point I’ve felt, hence why I created these very minimal test utils.
Looking at the Deno core repo it looks like there is no intention to include this kind of behaviour in Deno itself, so we may need a library to emerge eventually -https://github.com/denoland/deno/issues/4092.
That link does suggest some libraries are already having some success using Mocha for testing, as this has a browser mode and thus is compatible with Deno. Maybe check that out?
I might see if can put something together later in a new repo - I’ll drop a note here and will probably convert these tests over as an example.
@Leonardo-Rocha I have written a small blog post which demonstrates how you can use Mocha (similar to jest) to test your Deno code - check it out here: https://dev.to/craigmorten/testing-your-deno-apps-with-mocha-4f35
Thanks a lot, Craig! I read your response and I was just to reading mocha docs right now! Later I'll follow your tutorial and jump straight into Mocha. Btw I'm happy to see that you could create some content based on my suggestions. I'll also recommend your tutorial for my fellow brazilian devs.
Note: I gave the suggestions without realizing the complexity of it, after taking a look at Jest source code length I instantly regretted haha
@Leonardo-Rocha the best ideas always come from real problems people have - why I always welcome issues, comments, PRs etc!
Note: I gave the suggestions without realizing the complexity of it, after taking a look at Jest source code length I instantly regretted haha
I looked at it myself a week or so back while feeling ambitious and quickly changed my mind :joy:
It shouldn't be too hard to write simple hooks, but I think the effort is better placed adding wrappers, ports or using directly testing frameworks that are known to work well, have a large community of support and provide all these features already!
Suggestion
Hi @asos-craigmorten, I'm using your module (including the wrappers describe and it) and it would be great if some other Jest helper functions are also implemented, like the Setup and Teardown ones (beforeEach/All and afterEach/All) and Mock Functions.
Thanks.