I have a simple LWC component that is only made up of html, javascript, and css (no APEX). When deploying to production via vscode, I am confused on what I am suppose to be testing as I receive the "INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations" message. Am I missing something?
3 Answers
Specifying -l | --testlevel TESTLEVEL
did it for me:
sfdx force:auth:web:login -d -a <mydevhuborg>
sfdx force:source:deploy -p force-app -u <username> -l RunLocalTests
See the docs:
RunLocalTests—All tests in your org are run, except the ones that originate from installed managed packages.
-
Also if you have an org with way too many unit tests you don't want to run, you can pick "run specified tests" mode, and you only need to specify one single test class that passes (doesn't matter which b/c no Apex to cover) Jan 10, 2020 at 16:00
-
It is possible to not run tests if you covert to metadata first:
sfdx force:source:convert -r force-app -d deploy
Then you can deploy the resulting directory deploy
:
sfdx force:mdapi:deploy -d deploy -w -1 --verbose