我使用以下方法从头创建了scaffolded compoundjs app:
compound init test_app && cd test_app
比
compound g crud user id name password created:date
比
npm test
运行:./ node_modules / .bin / mocha --include test / init.js test / / .test.js
但是,我只收到以下输出错误:
> test_app@0.0.1 test /home/ubuntu/test_app
./ node_modules / .bin / mocha --include test / init.js test / / .test.js
✖ 1 of 10 tests failed:
1) UserController "before each" hook:
ReferenceError: getApp is not defined
at Context.<anonymous> (/home/ubuntu/test_app/test/controllers/users_controller.test.js:16:11)
at Hook.Runnable.run (/home/ubuntu/test_app/node_modules/mocha/lib/runnable.js:196:15)
at next (/home/ubuntu/test_app/node_modules/mocha/lib/runner.js:243:10)
at Object._onImmediate (/home/ubuntu/test_app/node_modules/mocha/lib/runner.js:254:5)
at processImmediate [as _immediateCallback] (timers.js:317:15)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
答案 0 :(得分:3)
使用mocha解决了问题:
mocha test/*