我有一個node.js/express/mocha項目。從我的項目的根目錄,我做的爲什麼不是bin/mocha運行我所有的測試?
./node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register test/**/*.coffee --reporter list
1) UnitsController /units.json "before all" hook
․ CordBloodUnit should set attrs: 0ms
․ CordBloodUnit #getMatchCount should get the match count of alleles: 0ms
․ pg-adapter #runQuery should get results of the query: 7ms
․ pg-adapter #runQuery should get Cord Blood Units: 4ms
4 passing (2s)
1 failing
1) UnitsController /units.json "before all" hook:
Error: timeout of 2000ms exceeded
at Object.<anonymous> (/Users/pguruprasad/Projects/jeevan-js/node_modules/mocha/lib/runnable.js:175:14)
at Timer.list.ontimeout (timers.js:101:19)
我看到所有的測試正在運行。但是當我想將長命令放在一個腳本中執行時,mocha只運行兩個測試並忽略其餘部分。這裏有什麼可能是錯的?
➜ ~jjs git:(master) ✗ touch test1
➜ ~jjs git:(master) ✗ echo "./node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register test/**/*.coffee --reporter list" >> test1
➜ ~jjs git:(master) ✗ cat test1
./node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register test/**/*.coffee --reporter list
➜ ~jjs git:(master) ✗ chmod +x test1
➜ ~jjs git:(master) ✗ ./test1
․ CordBloodUnit should set attrs: 0ms
․ CordBloodUnit #getMatchCount should get the match count of alleles: 0ms
2 passing (2ms)
你能添加一下'test /'的樹嗎?鑑於@ dankohn的答案不起作用? – Tracker1