I have written a bunch of tests for LWC. I'm trying to run it using sfdx force:lightning:lwc:test:run
but I run into:
ERROR running force:lightning:lwc:test:run: No lwc-jest executable found. Verify it is properly installed. Run "sfdx force:lightning:lwc:test:setup --help" for installation details.
I tried to install lwc-jest
using @salesforce/lwc-jest looks like it's been deprecated and has been renamed to @salesforce/sfdx-lwc-jest
.
Does this mean sfdx force:lightning:lwc:test:run
is referencing an older module (@salesforce/lwc-jest)?
Is there a way to fix this/what am I missing here?
Note: I'm able to run tests using npm run test:unit
.
Edit:
I tried installing jest using sfdx force:lightning:lwc:test:setup
and ran into the below issue:
ERROR running force:lightning:lwc:test:setup: npm command not found. Verify npm is properly installed and try again.
I have installed jest using:
npm install
npm install @salesforce/sfdx-lwc-jest --save-dev
NPM version - 6.4.1
NPM Path - C:\Users\UserName\AppData\Roaming\npm\node_modules
Node Version - v10.15.1
OS - Windows
sfdx force:lightning:lwc:test:setup
has failed.