简体   繁体   English

尝试设置Jasmine2HtmlReporter时出现“语法错误”

[英]Getting “Syntax error” when trying to setup Jasmine2HtmlReporter

Setting up Jasmine2HtmlReporter for my Protractor project. 为我的量角器项目设置Jasmine2HtmlReporter。

Adding next code to my conf.js file: 在我的conf.js文件中添加下一个代码:

    onPrepare: function() {
      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          savePath: 'target/screenshots'
        })
      );
   }

And getting next error: 并得到下一个错误:

onPrepare: function() {
  ^^^^^^^^^

SyntaxError: Unexpected identifier

Below my whole conf.js file: 在我的整个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'
        })
      );
   }

};

Put a comma after the "specs" key. 在“规格”键后面加上逗号。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jasmine HtmlReporter自称,发现自己未定义 - Jasmine HtmlReporter calls itself, finds itself undefined 测试React组件Jasmine和Webpack时的语法错误 - Syntax error when testing React component Jasmine and Webpack 尝试使用jasmine-jquery时如何解决“找不到变量:jasmine”错误? - How to fix “Can't find variable: jasmine” error when trying to use jasmine-jquery? 尝试运行茉莉花测试时获取未定义的控制器 - Getting controller undefined when trying to run jasmine test 在Rails中运行无头茉莉花测试时出现错误 - Getting an error when running headless jasmine tests in rails 收到错误订阅不是 jasmine 中的 function - getting error Subscribe is not a function in jasmine 尝试使用Jasmine间谍程序并出现“不是功能”错误 - Trying to use Jasmine spies and getting “is not a function” errors 我正在尝试使用茉莉花来测试我的角度控制器。 但我收到错误:[$ injector:modulerr] - i am trying to test my angular controller using jasmine. But i am getting Error: [$injector:modulerr] 茉莉花与骨干网的集成导致-未捕获的TypeError:无法读取HtmlReporter()中未定义的属性'env' - jasmine integration with backbone leads to - Uncaught TypeError: Cannot read property 'env' of undefined in HtmlReporter() 为什么在要求使用咖啡v1.6.2的规格文件时,茉莉花节点会抛出此错误? - why does jasmine-node throw this error when trying to require a spec file with coffee v1.6.2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM