Node.js – npm test <package>默默成功,没有任何输出?
npmtesting是检查软件包的一个很酷的方法。 如果包有问题,输出说'npm不好'。
# npm test transkode
而如果默认testing脚本通过它不显示任何输出。 我们可以启用testing日志吗?
我在node.js谷歌组search,发现在旧版本中启用testing输出。 看一些讨论 。
另外我没有看到这个NPMtesting文档的 npm文档中的任何选项
需要什么选项来启用输出?
npm test package
将运行一个包的testing脚本 ,testing脚本在package.json文件中configuration。 包的作者需要创build一个testing脚本来实际输出testing的结果。
例如,在一个示例CoffeeScript包的package.json中,我有
"scripts": { "test": "cake test" },
所以npm test myPackage
会调用cake test
。 我的Cakefile然后有一个testing任务,看起来像这样:
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来运行testing。 testing结果出现在控制台中。