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:
sfdx force:source:deploy -m ApexClass:MyClass -l RunLocalTests -u MyProductionOrg
If you're using
force:source:deploy, it doesn't work when deploying to production, which is why those
testLevel 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 the
The force:source:deploy, force:source:retrieve, and force:source:delete commands work on sandboxes, Developer Edition orgs, and trial orgs, but not production orgs. For production orgs, continue to use force:mdapi:deploy and force:mdapi:retrieve.
For a nice trick to deploy from Sandbox to Production, see my answer to this post - I use this on a daily basis now