[英]ChromeHeadless not starting: timing out when running ng test
I am working on an Angular 7 (7.2.13) app and am having trouble running npm run test
, which maps to ng test --watch=false --browsers=ChromeHeadless
.我正在开发一个 Angular 7 (7.2.13) 应用程序并且在运行
npm run test
时遇到问题,它映射到ng test --watch=false --browsers=ChromeHeadless
。
I am running Ubuntu under Windows 10 and all of my app-relating command line stuff is done on Ubuntu.我在 Windows 10 下运行Ubuntu ,我所有与应用程序相关的命令行内容都是在 Ubuntu 上完成的。 This is a requirement of the project, but I've only been here a few weeks and haven't yet found out why!
这是项目的要求,但我才来这里几周,还没有找到原因!
I have installed ChromeHeadless by following these instructions .我已经按照 这些说明安装了 ChromeHeadless。 I set
CHROME_BIN=/usr/bin/chromium-browser
after doing this.执行此操作后,我设置了
CHROME_BIN=/usr/bin/chromium-browser
。 However, it looks like ChromeHeadless is having trouble starting:但是,ChromeHeadless 似乎无法启动:
27 05 2019 11:26:40.497:INFO [karma-server]: Karma v4.0.1 server started at http://0.0.0.0:9876/
27 05 2019 11:26:40.497:INFO [karma-server]:Karma v4.0.1 服务器启动于http://0.0.0.0:9876/
27 05 2019 11:26:40.500:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited #
27 05 2019 11:26:40.500:INFO [launcher]:以无限并发的方式启动浏览器 ChromeHeadless #
27 05 2019 11:26:40.506:INFO [launcher]: Starting browser ChromeHeadless 27 05 2019 11:27:40.507:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.
27 05 2019 11:26:40.506:INFO [launcher]: 启动浏览器 ChromeHeadless 27 05 2019 11:27:40.507:WARN [launcher]: ChromeHeadless 在 60000 毫秒内没有被捕获,杀了。
27 05 2019 11:27:40.724:INFO [launcher]: Trying to start ChromeHeadless again (1/2).
27 05 2019 11:27:40.724:INFO [启动器]:尝试再次启动 ChromeHeadless (1/2)。
It tries again a few times, but just times out.它再试几次,但只是超时。 I have seen a few posts about turning on verbose logging, but modifying the
captureTimeout
has only the effect of making the process slower!我看过一些关于打开详细日志记录的帖子,但是修改
captureTimeout
只会使过程变慢!
Can anyone help?任何人都可以帮忙吗?
I solved an issue with this same message caused by a proxy-blocker of the client.我解决了由客户端的代理阻止程序引起的相同消息的问题。 I had to set
--proxy-server
flag in my customLauncher in karma.conf.js, so the karma server could get the ChromeHeadless and execute the tests perfectly.我必须在 karma.conf.js 中的 customLauncher 中设置
--proxy-server
标志,以便 karma 服务器可以获取 ChromeHeadless 并完美地执行测试。
karma.conf.js
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-bypass-list=*',
'--proxy-server=http://proxy.your.company'
]
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.