1

I am trying to create a MakeFile to run my Mocha unit tests with NPM. So I have Mocha installed and a unit test created in:

{project_root}/test/test.js

Now, when I try 'make test' Make replies with:

make: Nothing to be done for `test'.

Here's my MakeFile:

test:
    @./node_modules/.bin/mocha -u tdd
.PHONY: test

So real basic. I've read that Mocha will run all tests in the 'test' dir automatically. Is my MakeFile syntax incorrect?

Thanks!

4

3 回答 3

5

抱歉,我无法使用 make 语法,但我可以建议您在 package.json 中创建一个测试别名,以便您可以使用npm test. 这是一个很好的例子:https ://github.com/sequelize/sequelize/blob/master/package.json

于 2013-06-01T18:25:49.200 回答
3

您是否尝试过制表符而不是空格?

test:
  @NODE_ENV=test ./node_modules/.bin/mocha
.PHONY: test

问候,

于 2013-11-08T03:06:35.637 回答
2

我怀疑这是由不正确命名的 makefile 引起的。

将您的 makefile 重命名为makefileorMakefile并且不要使用大写字母F

于 2014-12-01T19:34:49.733 回答