6

Personally, I struggled to get value out of the Lightning Testing Service and felt it was very limited compared to e.g. Angular Testing. Working for an ISV, automated testing is key to keeping components working for both old and new customers.

Does anyone have information about testability of the Lightning Web Components?

8

Testing for LWC is implemented in Jest. These can be run locally to your org, or even enabled to run in "watch" mode to give you instant feedback while you code.

From the docs, LWC testing enables you to

  • Test a component in isolation
  • Test a component's public API
  • Test basic user interaction with a component
  • Verify the DOM output of a component
  • Verify that events fire when expected

There are a number of tests implemented in the e-bikes sample app in the sample app gallery.

Update

You can also read about it in the developer guide at https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.testing.

Spring 19 Pre-Release Note

Until it is updated for prerelease, you'll have to login to a pre-release org, and then go to the url:

https://[your.org.domain]/docs/component-library/documentation/lwc/lwc.testing

  • Thanks Peter. Interesting to see the package.json there too. – Keith C Dec 14 '18 at 14:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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