2

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 3

1

I chose an unrelated apex test class and it deployed successfully to production.

1

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.

2
  • 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)
    – Charles T
    Jan 10, 2020 at 16:00
  • @CharlesT thanks for the hint. That will come handy in some cases.
    – wp78de
    Jan 10, 2020 at 16:10
0

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 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .