1

This is similar to a previous question, however the context is different.

We have developed a custom LWC that uses the lightning-radio-group component and sets the variant so we can hide the label (keeping the label there for accessibility purposes). This works fine on our scratch orgs. However, this causes our jest tests to fail with:

Error: Unknown public property "variant" of element <lightning-radio-group>

Removing the variant property allows the tests for our component to pass, but this won't give us the UX we require.

We are using the following dependencies to pull in the LWC jest test framework with npm:

"devDependencies": {
  "@salesforce/lwc-jest": "^0.5.1",
  "js-yaml": "3.13.1",
  "jest": ">= 23.0.0"
}

Is there a way to get lwc-jest to work with the newest versions of the standard LWCs?

2

Different Context but the same answer ;) As you can see here the stub was not updated since two months.

You can:

  1. Open an Issue in the repo (that makes sense anyways i guess) and wait for an official fix
  2. You can locally edit the stubs in the package and add the attribute (or fork the repo and do it there)
  3. You can provide a own stub as explained here
  • FYI we submitted a pull request to fix the issue which was approved. – Phil W Jul 13 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.