sfdx-lwc-jest
sfdx-lwc-jest copied to clipboard
Map Releases to sourceApiVersion?
Description
This is just a documentation enhancement request. I have a project who's current sourceApiVersion is 46.0 I installed this latest package (0.6.2) and was met with the common error "expected
Thanks! Tim
Steps to Reproduce
None
We can definitely add this to the CHANGELOG.md
. @trevor-bliss What do you think about also tagging the version on NPM, the same way we do on LWC?
I don't mind using npm dist-tags to map previous releases to appropriate versions of this package.
We could also improve the error message thrown to help guide users to fixing the issue. Maybe pointing them to a section in the README that explains what's going on.
I've run into this same issue just now. My project sourceApiVersion is 47.0 I've just installed this package and when I run it I get:
Invalid sourceApiVersion found in sfdx-project.json. Expected 49.0, found 47.0
I can understand the prerelease thing where if you are developing on a prerelease version of Salesforce that you have to use a special branch because you are on the cutting edge. But I don't understand why I need to comb through old versions of this package to try find one that works with my project's sourceApiVersion.
I'm just starting out with Jest and testing in general so maybe there is something obvious I'm missing here but I really don't understand this at all. The way I would expect it to work would be for each new version to provide support for all previous versions rather than just the new version - that's how code libraries normally work isn't it?
I'm still not really clear how to fix this either. So, if the readme could explain this too that would be a great help. Thanks.
@dominic-butlerSFDC the outgoing release @salesforce/[email protected]
has been tagged as spring20
and @salesforce/[email protected]
as winter20
.
The latest
tag of sfdx-lwc-jest will always track with the current release of salesforce in production. If you wish to use version 47.0, please choose winter20
as the dependency version in package.json.
@ravijayaramappa thank-you for your response. I'm sorry but I think you need to spell this out a bit more clearly for me (and, I imagine, others). How, exactly do I 'choose winter20 as the dependency version in package.json'?
I've had a look through all the tags on this repo (which don't seem to provide any useful information that I can find - they don't mention which api version they are aligned with), I've read the README which doesn't explain how to do this. It's not mentioned in theCHANGELOG.md
either. How do I do this? If you explain I will write it up and add a PR. I doubt I'll be the only one who is confused by this. Thanks.
OK. I've found it on the npm site here:
https://www.npmjs.com/package/@salesforce/sfdx-lwc-jest under the Versions tab.
Is it possible to have this in the repo somewhere?
@pmdartus @trevor-bliss I'm actually having trouble finding said mapping that @dominic-butlerSFDC mentioned, I agree it would be nice to be in the repo somewhere.
Our SF instance also just upgraded to API v50, but specifying sourceApiVersion
of 50 causes the latest version of this package to fail with an expected instance of 49. It's causing all of our devs to have to create components, then manually go edit the XML file to update it to 50.
Do we have a timeline on when this package will be up to date to work with the latest SF release?
Here's the click path to what @dominic-butlerSFDC outlined:

There are sfdx plugins that can simplify bulk changes to API versions. See https://github.com/muenzpraeger/sfdx-plugin#sfdx-mzprsourceapiset. @mshanemc maintains an index of great sfdx plugins at https://github.com/mshanemc/awesome-sfdx-plugins.
@pmdartus @trevor-bliss I'm actually having trouble finding said mapping that @dominic-butlerSFDC mentioned, I agree it would be nice to be in the repo somewhere.
Our SF instance also just upgraded to API v50, but specifying
sourceApiVersion
of 50 causes the latest version of this package to fail with an expected instance of 49. It's causing all of our devs to have to create components, then manually go edit the XML file to update it to 50.Do we have a timeline on when this package will be up to date to work with the latest SF release?
Am having the same issue.
Is there another way to install prerelease into a Salesforce project? e.g. sfdx force:lightning:lwc:test:setup --prerelease
Or do we have to wait for it to be published?
Our Org is now on API v51, but installing sfdx-lwc-jest
version 0.11.0, which, from the versions tab on the NPM website, is the latest version, I receive the error:
error Invalid sourceApiVersion found in sfdx-project.json. Expected 50.0, found 51.0
@trevor-bliss @pmdartus Is there a release schedule or any documentation we can reference for expected release dates to know when we can update our sfdx-lwc-jest
packages to match current Org API versions?
Having the same issue. The current setup mapping against names but not the expect/found version numbers - or having a way to align those - is confusing. Helpful to know about the --skipApiVersionCheck
flag though while I get that sorted (listed in the documentation on NPM - https://www.npmjs.com/package/@salesforce/sfdx-lwc-jest)