Lesson8中無法測試throw error 代碼
app.test.js
當throw初error時無法正常測試,mocha返回
-
test/app.test.js should throw when n > 10: Error: Internal Server Error at _stream_readable.js:944:16
-
test/app.test.js should throw when n < 0: Error: Internal Server Error at _stream_readable.js:944:16
-
test/app.test.js should throw when n isnt Number: Error: Internal Server Error at _stream_readable.js:944:16
-
test/app.test.js should status 500 when error: Error: Internal Server Error at _stream_readable.js:944:16
能帮忙修复一下吗?
2015-06-01 16:18 GMT+08:00 Aaron [email protected]:
app.test.js
當throw初error時無法正常測試,mocha返回
test/app.test.js should throw when n > 10: Error: Internal Server Error at _stream_readable.js:944:16
test/app.test.js should throw when n < 0: Error: Internal Server Error at _stream_readable.js:944:16
test/app.test.js should throw when n isnt Number: Error: Internal Server Error at _stream_readable.js:944:16
test/app.test.js should status 500 when error: Error: Internal Server Error at _stream_readable.js:944:16
— Reply to this email directly or view it on GitHub https://github.com/alsotang/node-lessons/issues/38.
学习中,还不太会呢
@alsotang
//package.json
"dependencies": {
"express": "^4.13.3"
},
"devDependencies": {
"mocha": "^2.3.2",
"should": "^7.1.0",
"supertest": "^1.1.0"
}
- npm install mocha should supertest --save-dev 用这条命令安装的modules:
- node app.test.js 执行后报错,describe没定义,,搞不懂了。代码全copy下来也不行
/Users/mfhj-dz-001-151/Documents/node-lessons/lesson8/test/app.test.js:9 describe('test/app.test.js', function () { ^ ReferenceError: describe is not defined at Object.<anonymous> (/Users/mfhj-dz-001-151/Documents/node-lessons/lesson8/test/app.test.js:9:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3