尝试设置 Jasmine2HtmlReporter 时获取 "Syntax error"
Getting "Syntax error" when trying to setup Jasmine2HtmlReporter
为我的 Protractor 项目设置 Jasmine2HtmlReporter。
将下一个代码添加到我的 conf.js 文件中:
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
并得到下一个错误:
onPrepare: function() {
^^^^^^^^^
SyntaxError: Unexpected identifier
在我的整个 conf.js 文件下面:
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000
},
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine',
specs: ['specs/calbarSpec.js']
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
};
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000
},
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine',
specs: ['specs/calbarSpec.js'],
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
};
在 "specs" 键后加一个逗号。
为我的 Protractor 项目设置 Jasmine2HtmlReporter。
将下一个代码添加到我的 conf.js 文件中:
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
并得到下一个错误:
onPrepare: function() {
^^^^^^^^^
SyntaxError: Unexpected identifier
在我的整个 conf.js 文件下面:
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000
},
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine',
specs: ['specs/calbarSpec.js']
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
};
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000
},
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine',
specs: ['specs/calbarSpec.js'],
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/screenshots'
})
);
}
};
在 "specs" 键后加一个逗号。