我正在尝试在命令行中使用聚合物 CLI 运行测试$ polymer test
,但出现此错误:
TypeError: Cannot read property 'match' of undefined
error: cli runtime exception: TypeError: Cannot read property 'match' of undefined
error: TypeError: Cannot read property 'match' of undefined
at firefox (/usr/local/lib/node_modules/polymer-cli/node_modules/wct-local/lib/browsers.js:126:46)
at Object.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/wct-local/lib/browsers.js:88:38)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/wct-local/lib/browsers.js:4:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
我曾尝试关注有关组件测试的官方文档,但恐怕他们对此只字未提。
关于浏览器上的测试,例如运行$ polymer serve
并转到我的测试文件夹 url localhost:8081/components/my-component/test
,没关系,我可以看到我所有的测试都运行良好。
我尝试使用 运行$ polymer test -l chrome
,并且还搜索了类似的问题和问题,但我找不到该问题的任何解决方案。
信息:我正在使用聚合物 3,如在我的依赖项中:
"dependencies": {
"@polymer/font-roboto": "^3.0.2",
"@polymer/iron-icons": "^3.0.1",
"@polymer/paper-item": "^3.0.1",
"@polymer/paper-listbox": "^3.0.1",
"@polymer/paper-slider": "^3.0.1",
"@polymer/paper-spinner": "^3.0.1",
"@polymer/polymer": "^3.1.0",
"@vaadin/vaadin-context-menu": "^4.2.0"
},
"devDependencies": {
"@polymer/iron-demo-helpers": "^3.0.0-pre.19",
"@polymer/test-fixture": "^4.0.2",
"@webcomponents/webcomponentsjs": "^2.2.0",
"chai": "^4.2.0",
"mocha": "^5.2.0",
"sinon": "^7.2.2",
"wct-mocha": "^1.0.0"
}