Firefox的Web组件测试程序中的所有测试都失败

时间:2015-07-08 08:25:37

标签: polymer web-component-tester polymer-starter-kit

创建Polymer Starter Kit的干净副本后,使用Web Component Tester(" test" Gulp任务)运行测试会导致所有测试在Firefox中失败。

Chrome和IE中的测试都很顺利。

错误是:

firefox 39               ✖ my-greeting-basic.html
  Timed out loading http://localhost:2000/components/polymer-starter/my-greeting-basic.html?
    <unknown> at                          done at /components/mocha/mocha.js:1846:0
    <unknown> at        Runner.prototype.run/< at /components/mocha/mocha.js:5213:0
    <unknown> at   EventEmitter.prototype.emit at /components/mocha/mocha.js:616:0
    <unknown> at                       start/< at /components/mocha/mocha.js:5203:0
    <unknown> at     Runner.prototype.runSuite at /components/mocha/mocha.js:5103:0
    <unknown> at                         start at /components/mocha/mocha.js:5201:0
    <unknown> at          Runner.prototype.run at /components/mocha/mocha.js:5226:0
    <unknown> at           Mocha.prototype.run at /components/mocha/mocha.js:1849:0
    <unknown> at                             g at /bower_components/webcomponentsjs/webcomponents.min.js:11:0
    <unknown> at                             w at /bower_components/webcomponentsjs/webcomponents.min.js:11:0
    <unknown> at                             f at /bower_components/webcomponentsjs/webcomponents.min.js:11:0
    <unknown> at                             p at /bower_components/webcomponentsjs/webcomponents.min.js:11:0
404 GET /components/polymer-starter/my-list-basic.html
firefox 39               ✖ my-list-basic.html
  Timed out loading http://localhost:2000/components/polymer-starter/my-list-basic.html?
firefox 39               Tests failed: 2 failed tests
Test run ended in failure: 2 failed tests
Process terminated with code 1. 

在浏览器中,对测试套件的调用导致404s。

1 个答案:

答案 0 :(得分:2)

问题是Windows中的Firefox在路径中看到反斜杠时会搞砸。让我永远明白这一点,但我已经在相关项目上打开了一张票,并提交了一份我想出的修复请求。

如果您不耐烦,可以导航至<your project>/node_modules/web_component_tester/runner/webserver.js并在第80行(options.webserver.webRunnerContent = INDEX_TEMPLATE(options))之前添加以下内容

options.suites = options.suites.map(function (cv) {
  return cv.replace(/\\/g,'/');
})

这将改变Firefox中没有问题的正斜杠路径中的反斜杠。