Stubbing @std/x
I need some help understanding how to use the
stub()
method with @std/x
libraries.
The code above seems to satisfy the linter, but the test obviously fails with the following:
3 Replies
What you're trying to do is to mock a module's function, which is not supported.
Try this workaround:
That works like a charm.
Shame about the lack of support natively, but at least I am unblocked.
I think I might look into using external lib as I am not finding unit testing very easy using the @std libs
If the difficulties you're facing are related to mocking, stubbing and spying, feel free to open an issue at https://github.com/denoland/std/issues. Reporting your difficulties could be helpful to others