Javascript 我怎样才能用摩卡记事本做量角器?
我正在使用量角器(0.22.0)测试我的应用程序。 有没有可能用摩卡风格的记者而不是茉莉花风格的记者? 现在看起来是这样的:Javascript 我怎样才能用摩卡记事本做量角器?,javascript,protractor,mocha.js,jasmine-spec-reporter,Javascript,Protractor,Mocha.js,Jasmine Spec Reporter,我正在使用量角器(0.22.0)测试我的应用程序。 有没有可能用摩卡风格的记者而不是茉莉花风格的记者? 现在看起来是这样的: (....F...) 我看起来更像: my set of tests 1 my test 1-1 my test 1-2 my set of tests 2 my test 2-1 my test 2-2 查看量角器文档。安装Mocha后,您可以在.dragrator.conf.js文件中设置Mocha选项: mochaOpts: { report
(....F...)
我看起来更像:
my set of tests 1
my test 1-1
my test 1-2
my set of tests 2
my test 2-1
my test 2-2
查看量角器文档。安装Mocha后,您可以在.dragrator.conf.js
文件中设置Mocha选项:
mochaOpts: {
reporter: "spec",
}
您可以使用tap文件。很好 我不确定摩卡记者是否和茉莉花一起工作,但还有一些茉莉花记者比默认记者工作得更好 你需要茉莉花记者。需要将其作为依赖项。然后,您可以在量角器配置对象中调用
onPrepare
函数中的任意一个函数
npm i --save-dev jasmine-reporters
例如,使用TapReporter
。在您的量角器.config.js中执行此操作:
onPrepare: function() {
// The require statement must be down here, since jasmine-reporters
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.TapReporter());
},
对于茉莉花2.x和量角器>1.6
请参见此处的回复:
我正在使用这个模块,它工作得很好:。问题是我不想切换框架。我和茉莉花相处得很好。我只想换个记者。可能是
framework: "jasmine2",
onPrepare: function() {
// The require statement must be down here, since jasmine-reporters
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
var TapReporter = require('jasmine-reporters').TapReporter;
jasmine.getEnv().addReporter(new TeamCityReporter());
}