简体   繁体   English

在 vue 上使用 mocha 进行单元测试时如何解决错误?

[英]How can I solve error when unit testing with mocha on vue?

I using mocha to do unit testing to my vuetify project我使用mocha对我的 vuetify 项目进行单元测试

I had install it.我已经安装了它。 So I run npm run test:unit , there exist error like this :所以我运行npm run test:unit ,存在这样的错误:

npm ERR! Failed at the test-vuetify@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The full error like this :完整的错误是这样的:

在此处输入图片说明

How can I solve this error?我该如何解决这个错误?

Note :注意

When I first installed vuetify and tried unit testing, it worked.当我第一次安装 vuetify 并尝试单元测试时,它奏效了。 No error没有错误

After I edited some parts and ran the unit test, the above error appeared在我编辑了一些部分并运行单元测试后,出现了上述错误

How do I resolve this error?如何解决此错误?

Update :更新

I have updated the version of vuetify.我已经更新了 vuetify 的版本。 Is that what caused this error?这是导致此错误的原因吗?

I am confused to solve this error.我很困惑要解决这个错误。 Because all errors are located in the node-modules folder.因为所有错误都位于 node-modules 文件夹中。 Not in the component that I made不在我制作的组件中

I have got that problem often .我经常遇到这个问题。 I want to share what I do in that situation .我想分享我在那种情况下所做的事情。 I run npm update on project folder then I rerun test command again .我在项目文件夹上运行npm update然后我再次重新运行测试命令。 If it is solve , done .如果是解决,完成。 If not I delete all node_modules folder and run npm install and rerun test command .如果不是,我删除所有node_modules文件夹并运行npm install并重新运行 test command 。 Then my problem gone .然后我的问题消失了。 Hope you problem can solve too ..希望你的问题也能解决..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Jest和Spectator使用反应形式作为输入对子组件进行单元测试时,如何解决此错误? - How do I solve this error when unit testing child component with reactive form as input using Jest and Spectator? 如何解决 vuex 和单元测试的问题? - How can I solve problem with vuex and unit-testing? 使用 Mocha 使用 Typescript 对 Jquery 进行单元测试时,如何修复“$ 未定义”错误? - How to fix “$ is not defined” error when unit testing Jquery with Typescript using Mocha? 如何在 mocha 测试的 for 循环中使用“it” - How can I use “it” in a for loop in mocha testing 为什么在使用 firebase-functions-test、mocha 和 Emulator Suite 对 Firebase (Cloud) 函数进行单元测试时无法访问 .env 变量? - Why can't I access .env variables when unit testing Firebase (Cloud) Functions with firebase-functions-test, mocha, and Emulator Suite? 在netbeans中测试Angular Js期间如何解决错误? - How can I solve Error during testing Angular Js in netbeans? 单元测试时如何测试绑定函数的相等性? - How can I test for equality to a bound function when unit testing? 在使用Mocha和Chai断言测试NodeJS代码时,我怎么能期望从回调中抛出异常? - When testing NodeJS code with Mocha and Chai assertions, how can I expect an exception to be thrown from a callback? 角 | 摩卡单元测试 - Angular | Mocha Unit Testing 使用Mocha和Momentjs进行单元测试 - Unit testing with Mocha and Momentjs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM