这适用于咖啡 v1.4 和 v1.5,但最新版本现在让 jasmine 节点在我运行时抛出一个奇怪的错误:
茉莉花节点 --coffee --forceexit 规范/
/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/helpers.js:211
throw error;
^
SyntaxError: unexpected #
at Object.exports.throwSyntaxError (/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/helpers.js:209:13)
at Object.parser.yy.parseError (/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/coffee-script.js:245:20)
at Object.parse (/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/parser.js:535:22)
at exports.compile.compile (/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/coffee-script.js:36:25)
at Object.loadFile (/Users/aa/bitium/copernicus/node_modules/coffee-script/lib/coffee-script/coffee-script.js:179:28)
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 Object.jasmine.executeSpecsInFolder (/Users/aa/opensource/jasmine-node/lib/jasmine-node/index.js:136:7)
然而,如果我只是跑
jasmine-node --coffee --forceexit spec/unit
or
jasmine-node --coffee --forceexit spec/integration
它工作正常。它只是无法处理根级别的规范文件夹。Object.jasmine.executeSpecsInFolder 所做的只是 require(filename_of_a_spec) 不明白为什么这会是一个意外的 # 错误。