I am trying to run LWC Jest test, While i'm run this command:"sfdx force:lightning:lwc:test:run"
I am getting this error: 'sfdx-lwc-jest' is not recognized as an internal or external command,'.
Error body is:
C:\Testing\Auto59\test>sfdx force:lightning:lwc:test:run
'C:\Testing\Auto59\test\node_modules\@salesforce\sfdx-lwc-jest\bin\sfdx-lwc-jest' is not recognized as an internal or external command,
operable program or batch file.
Test run complete. Exited with status code: 1
Reference Link: https://github.com/salesforce/sfdx-plugin-lwc-test
Best Answer
This feature isn't installed by default.
You can add it via:
Or:
(The first
npm install
is not a typo; this is used to install all other named packages inpackage.json
and their dependencies.)Once installed, the command should then work as documented.
You can read more about this in the documentation.