首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我们可以在Windows的LWC上运行单元测试类吗?

我们可以在Windows的LWC上运行单元测试类吗?
EN

Stack Overflow用户
提问于 2019-11-22 05:28:34
回答 1查看 211关注 0票数 0

我是Lightning Web Component(LWC)单元测试的初学者。我在使用lwc-jest Node.js依赖测试我的LWC组件时遇到了问题。我在sourceApiVersion配置方面遇到了一些困难。当我运行测试时,测试显示

代码语言:javascript
复制
PS C:\Users\rdesai\Documents\GitHub\nimbusdevv> npm run test:unit

> nimbusdevv@1.0.0 test:unit C:\Users\rdesai\Documents\GitHub\nimbusdevv
> lwc-jest

error Invalid sourceApiVersion found in sfdx-project.json. Expected 47.0, found 45.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nimbusdevv@1.0.0 test:unit: `lwc-jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nimbusdevv@1.0.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\rdesai\AppData\Roaming\npm-cache\_logs\2019-11-21T19_21_35_974Z-debug.log

但是,当我使用sfdx plugins --core检查我的salesforcedx的当前状态时,它显示API版本为47。

代码语言:javascript
复制
PS C:\Users\rdesai\Documents\GitHub\nimbusdevv> sfdx plugins --core
@oclif/plugin-commands 1.2.3 (core)
@oclif/plugin-help 2.2.1 (core)
@oclif/plugin-not-found 1.2.3 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.5 (core)
analytics 1.2.1 (core)
generator 1.1.1 (core)
salesforcedx 47.6.2 (core)
├─ salesforcedx-templates 47.6.2 (core)
└─ salesforce-alm 47.9.0 (core)

sfdx-cli 7.33.2 (core)

希望有人能帮我弄清楚我哪里错了。

EN

回答 1

Stack Overflow用户

发布于 2020-11-13 20:49:11

检查位于项目根目录中的sfdx-project.json文件,并在文件中将API版本从45.0更改为47.0

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58984040

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档