npm test是检查包的一种很酷的方式。如果包有问题,输出会显示'npm is not ok‘。
# npm test transkode
而如果默认测试脚本通过,则不会显示任何输出。我们可以启用日志进行测试吗?
我在node.js google group中进行了搜索,发现在旧版本中启用了测试输出。 see some discussion。
此外,我在npm文档中也没有看到此NPM Test documentation的任何选项
需要什么选项才能启用输出?
发布于 2012-01-03 20:03:39
npm test package
将执行run a package's test script,测试脚本是在package.json文件中配置的。由包的作者创建一个测试脚本,该脚本将实际输出测试结果。
例如,在一个示例CoffeeScript包的package.json中,我有
"scripts": {
"test": "cake test"
},
因此npm test myPackage
将调用cake test
。然后,我的Cakefile有一个测试任务,如下所示:
task 'test', 'test against the specs', ->
command = extify 'jasmine-node'
args = ['--coffee', 'spec/']
jasmine = spawn command, args
jasmine.stdout.on 'data', (data) -> print data.toString()
jasmine.stderr.on 'data', (data) -> print data.toString()
它使用jasmine-node来运行测试。测试结果将显示在控制台中。
https://stackoverflow.com/questions/8715481
复制相似问题