随机Karma PhantomJS脚本在运行测试时出错

时间:2017-03-10 15:00:57

标签: angularjs jenkins gulp phantomjs karma-runner

我有一个gulp任务,使用karma测试运行器运行角度的jasmine单元测试。有一段时间我在Jenkins CI系统中得到了这些随机Script Errors,因此测试失败了。这些已经在我添加了29个单元测试之后开始,总共进行了160次单元测试(相当少)。他们没有显示任何失败。他们显示ERROR

  Pre-population Job Service
    ✓ should be registered
    .getJobList
      ✓ should get a list of pre-population jobs
    .getJobListWithID
      ✓ should get a single pre-population job
    .runJob
      ✓ should run a pre-population job
    .deleteJob
      ✓ should delete a pre-population job
    .editJob
      ✓ should edit a pre-pop job

  Publish Service
    ✓ should be registered
    .getPublishErrors
      ✓ should get an array of publishing errors successfully
      ✓ should not get an array of publishing errors if no data is obtained
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  Script error.

PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 142 of 153 ERROR (26.945 secs / 15.929 secs)


  Publish Service
    .republish
      ✓ should hit republish endpoint for a distribution
    .republishStatus
      ✓ should hit endpoint for a distribution to verify if it republished or not

  Republish Logs Service
    ✓ should be registered
    .getAllLogs
      ✓ should get an array of republishing logs

  Tasks Data Dump Service
    ✓ should be registered
    .getTasksDataDumpList
      ✓ should get a list of tasks data dump jobs
    .getTasksDataDump
      ✓ should get a single task data dump job
    .getOrganizations
      ✓ should get a list of instances with their sso id
    .runTasksDataDumpJob
      ✓ should run a tasks data dump job
    .deleteTasksDataDumpJob
      ✓ should delete a tasks data dump job
[20:09:50] 'test' errored after 29 s
[20:09:50] Error: Failed 1 tests.
    at /Users/newscred/projects/support-dashboard-interns/client/gulp/unit-tests.js:34:22
    at removeAllListeners (/Users/newscred/projects/support-dashboard-interns/client/node_modules/karma/lib/server.js:379:7)
    at Server.<anonymous> (/Users/newscred/projects/support-dashboard-interns/client/node_modules/karma/lib/server.js:390:9)
    at Server.g (events.js:291:16)
    at emitNone (events.js:91:20)
    at Server.emit (events.js:185:7)
    at emitCloseNT (net.js:1553:8)
    at _combinedTickCallback (internal/process/next_tick.js:71:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

在我的本地机器中,它有时会发生,有时它不会发生。但在我使用docker运行测试的Jenkins CI中,FAILS总是出现此脚本错误。并且在任何测试之后,此脚本错误都会随机出现,从而无法精确确定导致此错误的代码。在本地使用码头工具,测试也会通过。但是在CI中它总是失败,无论如何都失败了Script Error.我已经删除了任何来自外部脚本/任何$ watch或$ window相关测试代码的代码。这些解决方案都没有帮助我。这些是在OPEN Github问题https://github.com/karma-runner/karma/issues/1268

中提出的

我真的需要快速解决这个问题。 github问题仍然是开放的,这意味着它还没有解决,但我的项目基本没用,没有让它工作。请帮忙!

0 个答案:

没有答案