salesforce / sfdx-lwc-jest

Run Jest against LWC components in SFDX workspace environment
MIT License
165 stars 82 forks source link

Map Releases to sourceApiVersion? #123

Closed tsneed290 closed 1 year ago

tsneed290 commented 4 years ago

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 but got ". After some digging I found that 0.5.5 is what works with 46.0 sourceApiVersion. Would be nice to map this library's releases with the corresponding expecting sourceApiVersion, possibly in the CHANGELOG?

Thanks! Tim

Steps to Reproduce

None

pmdartus commented 4 years ago

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?

trevor-bliss commented 4 years ago

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.

dominic-butlerSFDC commented 4 years ago

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.

ravijayaramappa commented 4 years ago

@dominic-butlerSFDC the outgoing release @salesforce/sfdx-lwc-jest@0.7.1 has been tagged as spring20 and @salesforce/sfdx-lwc-jest@0.6.2 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.

dominic-butlerSFDC commented 4 years ago

@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.

dominic-butlerSFDC commented 4 years ago

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?

BatemanVO commented 4 years ago

@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?

kevinv11n commented 4 years ago

Here's the click path to what @dominic-butlerSFDC outlined:

Screen Shot 2020-10-15 at 1 24 24 PM
kevinv11n commented 4 years ago

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.

tonyward-auden commented 3 years ago

@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?

BatemanVO commented 3 years ago

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?

mugshepherd commented 3 years ago

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)