Colocating tests for Netlify Functions

This is actually not site specific (and maybe doesn’t belong here?) - I’m trying to keep my functions tests next to the files they test, it looks like support for this was added but at some point regressed (I’m also betting this repo isn’t core to how Functions work anymore): Ignore tests in lambda folder · Issue #99 · netlify/netlify-lambda · GitHub

Basically expecting *.{test,spec}.{js,ts} to be ignored by Netlify in my functions directory. Just wanted to make sure I’m not missing a config option or something for this.

Yeah, unfortunately there’s no way to exclude files as of now. But, we can pass that as a feature request.

An alternative would be to put all tests in /netlify/functions/tests/ folder. Sub-directories are not deployed as Functions, so that would be the closest workaround as of now.

1 Like

Alright I’ll try that, thanks for the tip! Ignoring tests would definitely be nice to have, I think most developers expect it at this point.