-
Notifications
You must be signed in to change notification settings - Fork 2
Advanced Level 3
takahito.miyamoto edited this page Feb 5, 2020
·
6 revisions
LWC のテストコードを実行してみましょう。Apex コードと違い、JacaScript コードにはテストカバレッジの制約はありませんが、品質のよいコードを書くためにテストコードは重要です。
npm install --save-dev --save-exact @salesforce/sfdx-lwc-jest
package.json の scripts に以下のコードを追加しましょう。
{
...
"scripts": {
...
"test:unit:jest": "sfdx-lwc-jest",
"test:unit:watch": "sfdx-lwc-jest --watch",
"test:unit:debug": "sfdx-lwc-jest --debug",
...
},
...
npm run test:unit:jest
# 例
Test Suites: 7 failed, 60 passed, 67 total
Tests: 12 failed, 140 passed, 152 total
🚧 更新中です 🚧
© 2019 Takahito Miyamoto @takahito0508
#HappyCoding !! #Trailheart #Multiplier | 17x #CertifiedPro | #SalesforceSaturday @SFSatTokyo @SFSatAkasaka | #AccentureCloudFirst | #AlwaysBeLearning #DontStopDeploying