Unit testing and developing Actions locally

I wanted to share with the community a library we’ve been working on internally to help developers build and test Actions locally, which we’ve just open sourced: @kilterset/auth0-actions-testing.

When writing our own Actions, we wanted to bring our typical development practices with us: test-first development, thorough unit testing, CI/CD support, and so on. There is a very basic starting point that the official docs suggests as to how you might start testing. We’ve taken that idea and built it into a robust Node.js library that has been helping us.

  • Unit test any Auth0 Action, with support for all Auth0’s Flows and Triggers.

  • Event mocks are randomly generated on each test run with realistic values. You can customize the properties that are important to your test while letting irrelevant properties randomly change. This helps flush out bugs caused by unintended assumptions around event data.

  • Support for testing HTTP requests is included. Quickly and easily mock responses and errors.

  • Extensive examples are provided, covering many common problems.

  • Type-hinting for all Auth0 Flows and Triggers (for editors which support this, like VS Code).

  • Run your unit tests in CI/CD pipeline. Bring your team’s engineering practices to your Actions code. Designed to work well with a0deploy.

I hope someone else out there finds this useful. I’d love to know if you’re using it. Feel free to leave feedback via GitHub issues.

2 Likes

Hi @pnicholls,

Welcome to the Auth0 Community!

Thanks for sharing your open-sourced Auth0 Actions Testing library! :clap: :+1:

I’m sure other community members will find this incredibly helpful!

Keep us posted if there’s anything we can assist you with.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.