Using Jest test with a traditional SF connection leads to a dilemma

Issue #1374 resolved
Alan Birchenough created an issue

I have a client who is not ready to move to SFDX, so we are all working in sandboxes. Meanwhile, I am engaged in a non-trivial LWC development, so I need the help of Jest tests to keep me honest. Here is the dilemma:

  • Jest extensions for LWC will not run without sfdx-project.json being present;
  • If sfdx-project.json is present, IC will give me only SFDX connection operations, not traditional ones. E.g., I can call Pull and Push, but not Refresh, which I use a LOT in the sandbox environment where we have multiple developers working in the same org. (That’s another pain point with this project, but again, the decision was made over our heads by the client.)

I was wondering if there is a neat way to get past this. Right now I just keep renaming sfdx-project.json depending on whether I am trying to run Jest LWC tests, or persuade IC to refresh my metadata. But there must be a better way….

Comments (3)

  1. Scott Wells repo owner

    Alan, the presence of an sfdx-project.json file does indicate that the IC project will use the Salesforce CLI, but it does not force the user of a scratch org and scratch org operations. If you create OAuth connections and associate one of those with the project instead, it will behave just like a traditional IC project except that the metadata must be source format and not metadata format. You will be able to use Deploy All/Modified Metadata, Refresh/Retrieve Metadata, etc.

    If the conversion from metadata format to source format is an issue, unfortunately I don't have a better option right now. Hopefully that will provide what you need, though.

  2. Alan Birchenough reporter

    Thanks for the explanation. We have all the source under version control in metadata format at present, and I don't see converting to source format at this point. (No one else on the project is even near to using the CLI.) So I guess I'll keep finagling for now.

  3. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  4. Log in to comment