Closed MonsterDeveloper closed 1 week ago
Would it be possible to expose the test helpers?
It's a mentioned issue, but commenting to highlight it.
@MonsterDeveloper just exposed InngestFunction#createExecution()
over at #618, released in 3.19.16.
Note that it's an internal method that can still change at any time; we'll add first-party testing tooling at a later date, but for now createExecution()
is indeed what we use for a lot of our internal unit tests.
cc @brijmcq
Yep, now it's possible to test functions as follows. But beware that it's unstable and is subject to change without notice.
Please see inngest/inngest#1680 for further conversation and progress on this. 🙂
@inngest/test is now available to provide some of these options.
Closing this as it was the original discussion around generic testing tools. Please raise issues/PRs against the @inngest/test
package if you'd like further changes! 🙂
Is your feature request related to a problem? Please describe. Setting up unit tests for Inngest functions is currently challenging due to a lack of guidelines in the official documentation. Exporting from
inngest.createFunction
requires exporting both the function itself and the function passed to it for testing.Describe the solution you'd like Enable the manual execution of declared functions. For example:
Additionally, include testing guidelines in the docs with practical examples.
Describe alternatives you've considered Exporting the handler callbacks passed into
inngest.createFunction
and testing them using mock objects.