在nodejs中执行mocha测试的npm测试时,'make'不被识别为内部或外部命令

时间:2013-09-17 09:02:16

标签: node.js mocha

执行mocha npm test时遇到以下问题

  

'make'未被识别为内部或外部命令,可操作   程序或批处理文件。错误的ERR!奇怪的错误1 npm ERR!不好的代码0

makefile:
 test:
   ./node_modules/.bin/mocha \
     --reporter list

 .PHONY: test

package.json

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js",
    "test": "make test"
  },
  "dependencies": {
    "express": "3.3.4",
    "jade": "*",
    "mongoose": ">= 2.6.5",
    "nodemailer": "0.3.20",
    "connect": ">= 1.9.1",
    "socket.io": "~0.9",
    "cookie": "0.0.4",
    "kue" : "*",
    "async" : "*",
    "mocha": "*",
    "should" : "*",
    "winston" : "*"
  }
}

1 个答案:

答案 0 :(得分:5)

您可能没有安装make。你在Windows上吗?

但是,您不需要也不应该使用make来运行测试。而是在package.json的底部添加以下内容:

  "scripts": {
    "test": "mocha -R list",
  }

现在,只需输入npm test即可运行测试。