Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/salesforcecli/plugin-lwc-test
Tools for unit testing Lightning web components in a Salesforce DX workspace
https://github.com/salesforcecli/plugin-lwc-test
Last synced: about 1 month ago
JSON representation
Tools for unit testing Lightning web components in a Salesforce DX workspace
- Host: GitHub
- URL: https://github.com/salesforcecli/plugin-lwc-test
- Owner: salesforcecli
- License: mit
- Created: 2019-08-07T18:02:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T06:52:02.000Z (6 months ago)
- Last Synced: 2024-06-26T22:45:53.660Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.31 MB
- Stars: 16
- Watchers: 18
- Forks: 9
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-sfdx-plugins - sfdx-plugin-lwc-test
README
@salesforce/sfdx-plugin-lwc-test
=============Tools for unit testing Lightning web components in a Salesforce DX workspace
## Usage
Install as a plugin in the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). While this plugin is in pilot you will need to manually install the plugin into your CLI.
```sh-session
$ sfdx plugins:install @salesforce/sfdx-plugin-lwc-test
$ sfdx force:lightning:lwc:test --help
```## Commands
### `sfdx force:lightning:lwc:test:create -f [--json] [--loglevel trace|debug|info|warn|error|fatal]`
create a Lightning web component test with boilerplate code inside a __tests__ directory
```
USAGE
$ sfdx force:lightning:lwc:test:create -f [--json] [--loglevel trace|debug|info|warn|error|fatal]OPTIONS
-f, --filepath=filepath (required) path to Lightning web component .js file to create a test
for--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) [default: warn] logging level for this command invocation
EXAMPLE
$ sfdx force:lightning:lwc:test:create -f force-app/main/default/lwc/myButton/myButton.js
```_See code: [src/commands/force/lightning/lwc/test/create.ts](https://github.com/trevor-bliss/sfdx-lwc-test/blob/v0.0.6/src/commands/force/lightning/lwc/test/create.ts)_
### `sfdx force:lightning:lwc:test:run [-d] [--watch] [--json] [--loglevel trace|debug|info|warn|error|fatal]`
invoke Lightning web component Jest unit tests
```
USAGE
$ sfdx force:lightning:lwc:test:run [-d] [--watch] [--json] [--loglevel trace|debug|info|warn|error|fatal]OPTIONS
-d, --debug run tests in debug mode
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) [default: warn] logging level for this command invocation
--watch run tests in watch modeEXAMPLES
$ sfdx force:lightning:lwc:test:run
$ sfdx force:lightning:lwc:test:run -w
```_See code: [src/commands/force/lightning/lwc/test/run.ts](https://github.com/trevor-bliss/sfdx-lwc-test/blob/v0.0.6/src/commands/force/lightning/lwc/test/run.ts)_
### `sfdx force:lightning:lwc:test:setup [--json] [--loglevel trace|debug|info|warn|error|fatal]`
install Jest unit testing tools for Lightning web components
```
USAGE
$ sfdx force:lightning:lwc:test:setup [--json] [--loglevel trace|debug|info|warn|error|fatal]OPTIONS
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) [default: warn] logging level for this command invocationEXAMPLE
$ sfdx force:lightning:lwc:test:setup
```_See code: [src/commands/force/lightning/lwc/test/setup.ts](https://github.com/trevor-bliss/sfdx-lwc-test/blob/v0.0.6/src/commands/force/lightning/lwc/test/setup.ts)_