- Clone this repository to your machine
- Navigate to the directory
- Type
sfdx plugins:link
to register the plugin
Expects you to already have a default scratch org configured for the environment that already holds a copy of all of your code as well as having Lightning Testing Service v1.4 installed. Also expects nyc to be installed and available from the command line.
To retrieve coverage you'll want to run a few commands:
sfdx coverage:ltng:instrument -r force-app -d lib-cov
Instrument all of the Aura bundles in your application directory and place instrumented code into thelib-cov
directory of your project. Also adds baseline coverage files to the.nyc-output
directory so you can report 0 coverage for anything not touched.sfdx force:mdapi:deploy -d lib-cov -w 15
push the instrumented code, and an adjustment to Lightning Testing Service, up to the default orgsfdx coverage:ltng:cover -a TestApp.app
run LTS and collect coverage data, saving coverage information into.nyc-output
directorynyc report
consume the generated data and report coverage levels.
should be used as a replacement for force:lightning:test:run that also retrieves coverage information
USAGE
$ sfdx-coverage coverage:ltng:cover
OPTIONS
-a, --appname=appname appname
-d, --outputdir=outputdir outputdir
-f, --configfile=configfile configfile
-o, --leavebrowseropen=leavebrowseropen leavebrowseropen
-r, --resultformat=resultformat [default: human] resultformat
-t, --timeout=timeout [default: 60000] timeout
-u, --targetusername=targetusername username or alias for the target org; overrides default target org
--apiversion=apiversion override the api version used for api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) logging level for this command invocation
EXAMPLE
$ sfdx coverage:ltng:cover -a TestApp.app --configfile config/lts.json
See code: src\commands\coverage\ltng\cover.ts
Uses istanbul to instrument your aura bundles inside of an SFDX project directory with some special sauce to make them Lightning compatible. Must still be uploaded to Salesforce.
USAGE
$ sfdx-coverage coverage:ltng:instrument
OPTIONS
-d, --outputdir=outputdir (required) output path for instrumented files
-r, --rootdir=rootdir (required) project root directory
-u, --targetusername=targetusername username or alias for the target org; overrides default target org
--apiversion=apiversion override the api version used for api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) logging level for this command invocation
EXAMPLE
$ sfdx coverage:ltng:instrument -r force-app -d lib-cov
See code: src\commands\coverage\ltng\instrument.ts