While deploying code in vsCode from sandbox to production I get the below error
sf:INVALID_OPERATION: INVALID_OPERATION: testLevel of NoTestRun cannot
be used in production organizations
As per the error, I need to change the value of testLevel but I am not able to find where and how can I change it to RunLocalTests
Could someone please help me to change the value of testLevel in vsCode
Best Answer
UPDATE 9/2019
As of Summer '19 v46.0,
force:source:deploy
now works when deploying to production, and you'll no longer get that testLevel error message.You can set the test level using the
-l
flag and use-u
to point to your connected Production org:OLD ANSWER
If you're using
force:source:deploy
, it doesn't work when deploying to production, which is why thosetestLevel
errors are showing up. As of Spring 19, you can't adjust those parameters (and this is by design as far as I can tell). This limitation can be found on theforce:source:deploy
documentation:For a nice trick to deploy from Sandbox to Production, see my answer to this post - I use this on a daily basis now