Skip to main content

If a code block fails repeatedly, Zap Manager will disable the Zap.

Good programming practices would exercise a code block in a unit test, essentially putting the code through scenarios known to have caused problems before (regression testing) and boundary conditions that can have dubious scenarios.

These can avoid failures, exceptions and unwanted results.

Question - what do you recommend for unit testing?

 

P.S. yes, I understand I can upload code blocks as AWS Lambdas and test them there. I’m looking for something simpler.

 

Hey @mrjcleaver!

It looks like a similar question was asked on how to catch errors in a Code step to prevent it from erroring over here:


Hopefully the suggestion in that related thread will be helpful to you in preventing your Zap from being switched off automatically. :)​​​


Hi @SamB - it's marginally related. Thanks for looking.

It's one thing is how to address a particular code block (check for each key, and value, and wrap the whole thing in a try/catch).

 

What I'm asking about is how to make sure the team has done that for every code block. i.e. there is professionalism throughout in every zap.

 

Whereas no-code environments like Zapier is targeted as being easy for non-coders, Zapier should still provide dependable results.

 

Test harnesses exercise pieces of functionality to achieve this.


Ah, I see! Sorry for my misunderstanding here previously, @mrjcleaver

I don’t believe we have a recommended unit testing process documented for Code by Zapier steps, but with our developer platform we do recommend using the Jest framework for unit testing. You can find out more about that here: Writing Unit Tests  

Hope that helps!