我试图弄清楚如何在复合中运行测试。当我运行 npm test 时,我收到以下错误。
describe('AccountController', function() {
^
ReferenceError: describe is not defined
at Object.<anonymous> (/Users/sugarfist/WebstormProjects/nimbus/test/controllers/accounts_controller.test.js:14:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at /Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/lib/nodeunit.js:75:37
at _concat (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:513:13)
at async.forEachSeries.iterate (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:123:13)
at async.forEachSeries (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:139:9)
at _concat (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:512:9)
at Object.doSeries [as concatSeries] (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:152:23)
at exports.runFiles (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/lib/nodeunit.js:73:15)
at _concat (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:518:13)
at async.forEach (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:110:25)
at _concat (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/deps/async.js:515:17)
at exports.modulePaths (/Users/sugarfist/WebstormProjects/nimbus/node_modules/nodeunit/lib/utils.js:65:24)
at Object.oncomplete (fs.js:297:15)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
我安装了应该、supertest 和 sinon,但我无法克服这个错误。我也尝试安装 jasmine 并运行它,但我得到 0 个断言......等等。谢谢!