karma测试框架安装、js压缩包安装 遇到的问题
因为最开始安装的时候,nodejs的目录是指向到C盘User目录下面的。所有的-g安装的包,也就全部都在那个目录下面了。
但通常情况下,新建项目都会随意放在其他盘里,于是基于这些包的安装,必须先引导到你的项目的目录下面去执行安装命令(npm install)。
在安装完karma的时候(命令:npm install karma),一直提示:no provider for framework:jasmine... 错误。后台经人指点,
进行了karma的初始化(命令:karma init,然后一直回车)。
1 ~ D:\workspace\javascript\karma>karma init 2 3 Which testing framework do you want to use ? 4 Press tab to list possible options. Enter to move to the next question. 5 > jasmine 6 7 Do you want to use Require.js ? 8 This will add Require.js plugin. 9 Press tab to list possible options. Enter to move to the next question. 10 > no 11 12 Do you want to capture a browser automatically ? 13 Press tab to list possible options. Enter empty string to move to the next question. 14 > Chrome 15 > 16 17 What is the location of your source and test files ? 18 You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js". 19 Enter empty string to move to the next question. 20 > 21 22 Should any of the files included by the previous patterns be excluded ? 23 You can use glob patterns, eg. "**/*.swp". 24 Enter empty string to move to the next question. 25 > 26 27 Do you want Karma to watch all the files and run the tests on change ? 28 Press tab to list possible options. 29 > yes 30 31 Config file generated at "D:\workspace\javascript\karma\karma.conf.js".
最后再安装jasmin(命令:npm install karma-jasmine
)。
最最后,配置测试文件的路径,输入:karma start,就OK了!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。