openfaas / templates

OpenFaaS Classic templates
https://www.openfaas.com
MIT License
276 stars 228 forks source link

Run unit tests for node12 if present #196

Closed alexellis closed 4 years ago

alexellis commented 4 years ago

Run unit tests for node12 if present

This change allows npm test to be run in during the Docker build of code using the node12 template. Unfortunately the package.json that the template generated will fail for any users who take this newer version, unless they edit the "test" section of their package.json file.

This is because it is hard-coded to "exit 1", the newer change is set to "exit 0" and to only show a warning about tests missing. It will not affect any functions that are created after this time.

Tested with 3 scenarios:

Signed-off-by: Alex Ellis (OpenFaaS Ltd) alexellis2@gmail.com

This was change requested by a user on Slack, but is consistent with the Java and Go templates. All templates should try to run tests if they are available.

alexellis commented 4 years ago

Docs update: https://github.com/openfaas/docs/commit/d86942bc064030dbe970d4e8311d7b2ed2f083cd