Can we execute Mocha test cases before deployment?

I have my Mocha test suite ready, before or deploying my code to corresponding environment, I want to invoke test cases in local and after deployment I want to invoke mocha test cases at the corresponding env.
Or do I have to use some CICD tool to achieve this?