的Makefile - 內容:不能與CoffeeScript的運行摩卡
REPORTER = dot
all: build
build:
@./node_modules/coffee-script/bin/coffee \
-c \
-o lib src
clean:
rm -rf lib
mkdir lib
watch:
@./node_modules/coffee-script/bin/coffee \
-o lib \
-cw src
test:
@./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
test/*.coffee
.PHONY: build clean watch test
項目根目錄下有兩個文件,一個測試文件夾:mocha.opts和example.coffee
example.coffee - 內容
describe "feature", ->
it "should add two numbers", ->
(2+2).should.equal 4
在運行make test
,得到以下錯誤:
cribe 'feature',
^^^^^^^^^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected string
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /home/my_username/testcode/coffeepress/node_modules/mocha/bin/_mocha:261:27
at Array.forEach (native)
at load (/home/my_username/testcode/coffeepress/node_modules/mocha/bin/_mocha:258:9)
at Object.<anonymous> (/home/my_username/testcode/coffeepress/node_modules/mocha/bin/_mocha:249:1)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)
使用js文件運行Mocha成功,但無法使其與CoffeeScript一起運行。我真的想 - 爲了代碼簡潔。
請指導。
也許更新這起進而體現V2缺乏一個破折號。 '咖啡:coffeescript/register'爲我工作 – aaaaaa 2018-01-23 19:52:37