Newer Version Available

This content describes an older version of this product. View Latest

Use Other Frameworks

Create Lightning component wrappers to use testing frameworks other than Jasmine or Mocha.

LTS provides a way to use standard JavaScript test frameworks with your Lightning components. We’ve provided the example test suites implemented in Jasmine and Mocha. These are well-regarded test frameworks, and if you haven’t chosen one already, we recommend you start with one of them.

If you’d prefer to use another test framework, either because you’ve already selected one, or because you find something more to your taste, you can use it with LTS instead.

All of the packaged pieces of LTS are included in the project repository, in the lightning-component-tests/test/default directory. To create a wrapper for another test framework, modify or replace these items from the Jasmine wrapper.

  • aura/jasmineTests—The front end of LTS.is simple app includes the test runner component, and a list of test suites to feed it.
  • aura/lts_jasmineRunnerthe test runner component for Jasmine. It includes references to the required Jasmine library, which it loads along with the test spec resources, and then fires the test runner.
  • lts_jasmine.resourcethe Jasmine library, unmodified.
  • lts_jasmineboot.resource JavaScript IIFE that launches Jasmine in the LTS context.
  • lts_testutil.resource—A collection of utilities for use within your test specs, and by the test framework wrappers. They provide Lightning component-specific functions that make it easier to test your custom components from a test context.

The Mocha version of the framework wrapper provides similar files. You might find the similarities and differences instructive in creating your own adapter for other frameworks.