# Perform basic test automatically before upload

**URL:** <https://forum.serverless.com/t/perform-basic-test-automatically-before-upload/10613>\
**Category:** Serverless Framework\
**Created:** [February 19, 2020, 11:21am UTC](https://forum.serverless.com/t/perform-basic-test-automatically-before-upload/10613 "2020-02-19T11:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [February 19, 2020, 11:21am UTC](https://forum.serverless.com/t/perform-basic-test-automatically-before-upload/10613/1 "2020-02-19T11:21:34Z")

</div>

Is there are an easy way to have sls run a (unit) test automatically when I run `sls deploy` (with or without a function name) ?

I’m finding a few times I’ll make a minor change, introduced a typo, but not find out till after I’ve waited for the upload, deploy and then hit the API itself.

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [February 24, 2020, 2:38pm UTC](https://forum.serverless.com/t/perform-basic-test-automatically-before-upload/10613/2 "2020-02-24T14:38:34Z")

</div>

I assume that’s no then.

We’ll have to stick to telling people to run

`npm tests && sls deploy`

which is less elegant.

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [February 26, 2020, 10:12am UTC](https://forum.serverless.com/t/perform-basic-test-automatically-before-upload/10613/3 "2020-02-26T10:12:17Z")

</div>

Hmm, maybe [https://github.com/uswitch/serverless-hooks-plugin](https://github.com/uswitch/serverless-hooks-plugin) is what I want, with a hook that runs our gulp test task ?
