7

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?

1 Answer 1

10

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .