运行Angular Jasmine的Gitlab CI测试崩溃而没有错误 [英] Gitlab CI running Angular Jasmine tests crashing without error

查看:109
本文介绍了运行Angular Jasmine的Gitlab CI测试崩溃而没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚在我的Angular项目中设置了Gitlab CI来运行Jasmine测试,我发现管道会炸裂,几乎看不出原因.

Having just setup Gitlab CI to run the Jasmine tests in my Angular project, I found the pipeline would bomb out with very little indication of the cause.

使用ng test在本地运行或在无头Chrome中本地运行时,我所有的测试都会通过(遵循

All my tests would pass when run locally using ng test or locally in headless Chrome (having followed docs and another guide to set that up). However, the pipeline would get to around 13/90 tests and then disconnect.

这是调试输出的示例(在 karma.conf.js 中为logLevel: config.LOG_DEBUG):

Here's a sample of the debug output (with logLevel: config.LOG_DEBUG in karma.conf.js):

HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 2 of 92 SUCCESS (0 secs / 0.311 secs)
HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 3 of 92 SUCCESS (0 secs / 0.475 secs)
15 03 2019 00:09:46.911:DEBUG [middleware:source-files]: Requesting /assets/img/logo.png
HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 11 of 92 SUCCESS (0 secs / 1.659 secs)
15 03 2019 00:09:47.738:DEBUG [middleware:source-files]: Requesting /media/img/showcase-image.jpg
HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 12 of 92 SUCCESS (0 secs / 1.875 secs)
15 03 2019 00:09:48.312:DEBUG [HeadlessChrome 74.0.3723 (Linux 0.0.0)]: Disconnected during run, waiting 2000ms for reconnecting.
15 03 2019 00:09:48.312:DEBUG [HeadlessChrome 74.0.3723 (Linux 0.0.0)]: EXECUTING -> EXECUTING_DISCONNECTED
15 03 2019 00:09:50.320:WARN [HeadlessChrome 74.0.3723 (Linux 0.0.0)]: Disconnected (0 times)reconnect failed before timeout of 2000ms (transport close)
HeadlessChrome 74.0.3723 (Linux 0.0.0) ERROR
  Disconnectedreconnect failed before timeout of 2000ms (transport close)
HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 12 of 92 DISCONNECTED (4.476 secs / 1.875 secs)
HeadlessChrome 74.0.3723 (Linux 0.0.0) ERROR
HeadlessChrome 74.0.3723 (Linux 0.0.0): Executed 12 of 92 DISCONNECTED (4.476 secs / 1.875 secs)
15 03 2019 00:09:50.340:DEBUG [karma-server]: Run complete, exiting.

推荐答案

当我开始将降级的Angular 8服务导入Angular JS(1.x)服务时,我们在Angular混合应用程序中遇到了相同的错误.我们能够通过在我们的 karma.cong.js

We ran into the same error in an Angular hybrid app once I started importing downgraded Angular 8 services into Angular JS (1.x) services. We were able to resolve the issue by setting the "--js-flags=--max-old-space-size=8196" flag for HeadlessChrome in our karma.cong.js

    customLaunchers: {
        headlessChrome: {
            base: "ChromeHeadless",
            flags: [
                "--no-sandbox",
                "--js-flags=--max-old-space-size=8196", <<< add this
            ],
        },
    },

这篇关于运行Angular Jasmine的Gitlab CI测试崩溃而没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆