断开连接重新连接在X MS的超时之前失败(传输关闭)

发布于 2025-01-27 15:50:26 字数 1834 浏览 4 评论 0原文

我在Windows上使用-NO-SandBox标志在Windows上运行测试很难。没有它,它没有问题,但是如果没有问题,我会得到错误

断开连接在X MS(传输关闭)超时之前的重新连接

超时范围内失败,它运行的是没有问题的毫无问题,没有标志,它说它不受支持或类似的东西。

您是否遇到过这样的问题?您是如何解决它们的?

我在堆栈和网上检查了大多数问题,但似乎没有解决这个问题。

我尝试了 - 设置其他不同的标志,但是我尝试删除此标志的设置都没有工作

- 但这在Docker中需要。

我尝试更新所有测试库 - 没有任何帮助。

这是我的业力配置

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

// this ensures we always have a fresh chrome copy
// and that it's usable in a ci/cd perspective
const process = require('process');

process.env.CHROME_BIN = require('puppeteer').executablePath()

module.exports = function (config) {
  config.set({
    debugMode: true,
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      jasmine: {
        random: false
      }
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, './coverage/Frontend'),
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox']
      }
    },
    singleRun: true,
    restartOnFileChange: true,
  });
};

I have trouble running tests on Windows with the --no-sandbox flag. Without it, it works with no issues, but if not then I get the error

Disconnected reconnect failed before timeout of x ms (transport close)

Within the docker it runs with no issues with --no-sandbox flag and without the flag it says that it's not supported or something like that.

Have you experienced such issues? How did you manage to solve them?

I checked most of the questions on stack and on the web, but it seems that nothing solves this issue.

I tried - setting additional, different flags, but none of the setups worked

I tried removing this flag - but that's needed in docker.

I tried updating all of the test libraries - nothing helps.

Here is my karma config

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

// this ensures we always have a fresh chrome copy
// and that it's usable in a ci/cd perspective
const process = require('process');

process.env.CHROME_BIN = require('puppeteer').executablePath()

module.exports = function (config) {
  config.set({
    debugMode: true,
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      jasmine: {
        random: false
      }
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, './coverage/Frontend'),
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox']
      }
    },
    singleRun: true,
    restartOnFileChange: true,
  });
};

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧夏天 2025-02-03 15:50:26

如果可能的话,您可以有2个脚本。

尝试进行以下更改:

browsers: ['ChromeHeadlessNoSandbox', 'Chrome'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox']
      }

package.json

"test": "ng test --browsers ChromeHeadlessNoSandbox",
"test:windows": "ng test --browsers Chrome"

这样。基本上是一个用于Windows测试的脚本,另一个用于Docker/CI/CD的脚本。

If possible, you can have 2 scripts.

Try making the following changes:

browsers: ['ChromeHeadlessNoSandbox', 'Chrome'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox']
      }

package.json

"test": "ng test --browsers ChromeHeadlessNoSandbox",
"test:windows": "ng test --browsers Chrome"

Something like that. Basically one script for the tests in Windows and another for the Docker/CI/CD.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文