unit test karma:Karma是一个基于Node.js的JavaScript测试执行过程管理工具(Test Runner)。 mocha:mocha是一个基于nodejs和浏览器集合的各种特性的JavaScript测试库。 chai:chai是一个基于nodejs的断言库,并且完美支持各种主流的JavaScript测试框架。
#1.npm install karma-cli -g Which testing framework do you want to use ? Press tab to list possible options. Enter to move to the next question.
mocha
Do you want to use Require.js ? This will add Require.js plugin. Press tab to list possible options. Enter to move to the next question.
no
Do you want to capture any browsers automatically ? Press tab to list possible options. Enter empty string to move to the next question.
Chrome
What is the location of your source and test files ? You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js". Enter empty string to move to the next question.
Should any of the files included by the previous patterns be excluded ? You can use glob patterns, eg. "**/*.swp". Enter empty string to move to the next question.
Do you want Karma to watch all the files and run the tests on change ? Press tab to list possible options.
yes