lucono/karma-test-explorer

Failed to load tests - Karma server failed to connect: Browser Failure - cannot start

Closed this issue ยท 25 comments

Describe the Bug
hi,

I am using Windows Linux Subsystem for develop.

I am having an Angular project with tests. I want to use the extension but the tests are not loaded due to the following issues

image

Here is my karma.config

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

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

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage'),
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-teamcity-reporter')
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageReporter: {
      dir: require('path').join(__dirname, './coverage/myproject'),
      reporters: [
        { type: 'html' },
        { type: 'lcovonly' },
        { type: 'text-summary' },
        { type: 'teamcity' },
      ],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml', 'teamcity'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['chrome_no_sandbox'],
    customLaunchers: {
      chrome_no_sandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox',
          '--disable-dev-shm-usage',
          '--disable-setuid-sandbox',
          '--disable-gpu',
        ],
      },
    },
    singleRun: true
  });
};

Here is the log

[2023-04-28 14:52:53.699] [DEBUG] [Adapter]: Creating server output channel
[2023-04-28 14:52:53.699] [DEBUG] [Adapter]: Creating port acquisition client
[2023-04-28 14:52:53.699] [DEBUG] [Adapter]: Creating debugger
[2023-04-28 14:52:53.700] [DEBUG] [Adapter]: Creating project commands handler
[2023-04-28 14:52:53.700] [DEBUG] [Commands]: Registering command 'ShowLog' as namespaced command 'karmaTestExplorer.frontend: cirium-profiles:ShowLog
[2023-04-28 14:52:53.700] [DEBUG] [Commands]: Registering command 'Reset' as namespaced command 'karmaTestExplorer.frontend: cirium-profiles:Reset
[2023-04-28 14:52:53.700] [DEBUG] [Adapter]: Creating notifications handler
[2023-04-28 14:52:53.700] [DEBUG] [Adapter]: Creating test emitters
[2023-04-28 14:52:53.707] [DEBUG] [Adapter]: Assembling new test explorer
[2023-04-28 14:52:53.707] [DEBUG] [Adapter]: Re/creating test explorer with extension configuration: {
  "logger": {
    "loggerName": "ExtensionConfig",
    "appender": {
      "outputChannelName": "Karma Test Explorer (frontend: cirium-profiles)",
      "options": {
        "enabled": true,
        "lazyCreate": false
      },
      "outputChannel": {
        "name": "Karma Test Explorer (frontend: cirium-profiles)"
      }
    },
    "logLevel": "debug"
  },
  "projectType": "angular",
  "projectName": "cirium-profiles",
  "projectPath": "/c/Projects/cirium-profiles/src/frontend",
  "projectInstallRootPath": "/c/Projects/cirium-profiles/src/frontend",
  "projectKarmaConfigFilePath": "/c/Projects/cirium-profiles/src/frontend/karma.conf.js",
  "baseKarmaConfFilePath": "/home/ubuntu/.vscode-server/extensions/lucono.karma-test-explorer-0.8.2/dist/karma.conf.cjs",
  "karmaPort": 9976,
  "testTriggerMethod": "http",
  "testParsingMethod": "ast",
  "failOnStandardError": false,
  "defaultSocketConnectionPort": 9999,
  "logLevel": "debug",
  "karmaLogLevel": "info",
  "karmaReporterLogLevel": "disable",
  "autoWatchEnabled": true,
  "karmaReadyTimeout": 900000,
  "testGrouping": "folder",
  "flattenSingleChildFolders": true,
  "environment": {},
  "envExclude": [],
  "reloadOnKarmaConfigChange": true,
  "customLauncher": {
    "base": "Chrome",
    "flags": [
      "--headless",
      "--disable-gpu",
      "--disable-dev-shm-usage",
      "--remote-debugging-port=9222"
    ]
  },
  "testFiles": [
    "**/*{.,-,_}{test,spec}.{ts,js}",
    "**/{test,spec}{.,-,_}*.{ts,js}"
  ],
  "allowGlobalPackageFallback": true,
  "excludeDisabledTests": false,
  "showOnlyFocusedTests": false,
  "showUnmappedTests": true,
  "showTestDefinitionTypeIndicators": true,
  "debuggerConfig": {
    "name": "Karma Test Explorer Debugging",
    "type": "chrome",
    "request": "attach",
    "browserAttachLocation": "workspace",
    "address": "localhost",
    "port": 9222,
    "timeout": 60000,
    "webRoot": "/c/Projects/cirium-profiles/src/frontend"
  },
  "reloadOnChangedFiles": [],
  "defaultDebugPort": 9222,
  "excludeFiles": [
    "**/node_modules/**/*"
  ]
}
[2023-04-28 14:52:53.707] [DEBUG] [Adapter]: Creating main factory
[2023-04-28 14:52:53.707] [DEBUG] [MainFactory]: Detecting test framework from karma config file: /c/Projects/cirium-profiles/src/frontend/karma.conf.js
[2023-04-28 14:52:53.708] [DEBUG] [SimpleFileHandler]: Reading file synchronously: /c/Projects/cirium-profiles/src/frontend/karma.conf.js
[2023-04-28 14:52:53.710] [DEBUG] [MainFactory]: Detected frameworks from karma config: jasmine, @angular-devkit/build-angular
[2023-04-28 14:52:53.710] [DEBUG] [MainFactory]: Detected test framework: jasmine
[2023-04-28 14:52:53.710] [INFO] [MainFactory]: Using test framework: jasmine (auto-detected)
[2023-04-28 14:52:53.710] [DEBUG] [MainFactory]: Creating test helper
[2023-04-28 14:52:53.710] [DEBUG] [MainFactory]: Creating process handler
[2023-04-28 14:52:53.711] [DEBUG] [MainFactory]: Creating test locator
[2023-04-28 14:52:53.711] [DEBUG] [MainFactory]: Creating AST test definition provider
[2023-04-28 14:52:53.712] [DEBUG] [MainFactory]: Creating test store
[2023-04-28 14:52:53.712] [DEBUG] [Adapter]: Getting process handler from factory
[2023-04-28 14:52:53.712] [DEBUG] [Adapter]: Getting test locator from factory
[2023-04-28 14:52:53.712] [DEBUG] [Adapter]: Getting test store from factory
[2023-04-28 14:52:53.712] [DEBUG] [Adapter]: Getting test manager from factory
[2023-04-28 14:52:53.718] [DEBUG] [AngularFactory]: Creating Angular test server executor
[2023-04-28 14:52:53.718] [INFO] [AngularFactory]: Using Angular project 'cirium-profiles' at root path '/c/Projects/cirium-profiles/src/frontend' and karma config file '/c/Projects/cirium-profiles/src/frontend/karma.conf.js'
[2023-04-28 14:52:53.720] [DEBUG] [KarmaFactory]: Creating Karma http test run executor
[2023-04-28 14:52:53.721] [DEBUG] [Adapter]: Getting file watcher from factory
[2023-04-28 14:52:53.721] [DEBUG] [FileWatcher]: Creating file watchers for monitored files
[2023-04-28 14:52:53.722] [DEBUG] [FileWatcher]: Registering file handler for files: [
  "karma.conf.js"
]
[2023-04-28 14:52:53.722] [DEBUG] [FileWatcher]: Creating file watcher for file or pattern 'karma.conf.js' using base path: /c/Projects/cirium-profiles/src/frontend
[2023-04-28 14:52:53.723] [DEBUG] [FileWatcher]: Creating file watchers for test file changes
[2023-04-28 14:52:53.723] [DEBUG] [FileWatcher]: Registering file handler for files: [
  "**/*{.,-,_}{test,spec}.{ts,js}",
  "**/{test,spec}{.,-,_}*.{ts,js}"
]
[2023-04-28 14:52:53.723] [DEBUG] [FileWatcher]: Creating file watcher for file or pattern '**/*{.,-,_}{test,spec}.{ts,js}' using base path: /c/Projects/cirium-profiles/src/frontend
[2023-04-28 14:52:53.723] [DEBUG] [FileWatcher]: Creating file watcher for file or pattern '**/{test,spec}{.,-,_}*.{ts,js}' using base path: /c/Projects/cirium-profiles/src/frontend
[2023-04-28 14:52:53.724] [DEBUG] [Adapter]: Creating test explorer
[2023-04-28 14:52:53.724] [DEBUG] [KarmaTestExplorer]: Test load started
[2023-04-28 14:52:53.724] [DEBUG] [KarmaTestExplorer]: Test hard refresh started
[2023-04-28 14:52:53.725] [DEBUG] [TestLocator]: Refresh requested for all spec file(s): ["**/*{.,-,_}{test,spec}.{ts,js}","**/{test,spec}{.,-,_}*.{ts,js}"]
[2023-04-28 14:52:53.726] [DEBUG] [TestLocator]: No refresh currently in progress - will commence new refresh for files: ["**/*{.,-,_}{test,spec}.{ts,js}","**/{test,spec}{.,-,_}*.{ts,js}"]
[2023-04-28 14:52:53.727] [DEBUG] [TestLocator]: Refreshing all spec file(s): ["**/*{.,-,_}{test,spec}.{ts,js}","**/{test,spec}{.,-,_}*.{ts,js}"]
[2023-04-28 14:52:53.755] [DEBUG] [KarmaTestExplorer]: Refresh request - Test manager is not started - Starting it
[2023-04-28 14:52:53.782] [DEBUG] [PortAcquisitionClient]: Request for 1 port(s) at base port 9976 acquired: 9976
[2023-04-28 14:52:53.783] [INFO] [DefaultTestManager]: Using requested --> available karma port: 9976 --> 9976
[2023-04-28 14:52:53.797] [DEBUG] [PortAcquisitionClient]: Request for 1 port(s) at base port 9999 acquired: 9999
[2023-04-28 14:52:53.798] [INFO] [DefaultTestManager]: Using requested --> available karma listener socket port: 9999 --> 9999
[2023-04-28 14:52:53.808] [DEBUG] [PortAcquisitionClient]: Request for 1 port(s) at base port 9222 acquired: 9222
[2023-04-28 14:52:53.810] [INFO] [DefaultTestManager]: Using requested --> available debug port: 9222 --> 9222
[2023-04-28 14:52:53.811] [DEBUG] [KarmaTestListener]: Attempting to listen on port 9999
[2023-04-28 14:52:53.820] [INFO] [KarmaTestServer]: Starting karma server
[2023-04-28 14:52:53.821] [DEBUG] [AngularTestServerExecutor]: Executing server start with karma port '9976' and karma socket port '9999'
[2023-04-28 14:52:53.830] [DEBUG] [AngularTestServerExecutor]: Found '@angular/cli' module at: /c/Projects/cirium-profiles/src/frontend/node_modules/@angular/cli
[2023-04-28 14:52:53.833] [DEBUG] [AngularTestServerExecutor::SimpleProcess]: Process 22ynlywnbur: 
Executing command: '/home/ubuntu/.nodenv/shims/node' 
with args: ["/c/Projects/cirium-profiles/src/frontend/node_modules/@angular/cli/bin/ng","test","cirium-profiles","--karma-config=/home/ubuntu/.vscode-server/extensions/lucono.karma-test-explorer-0.8.2/dist/karma.conf.cjs","--progress=false","--no-watch"]
[2023-04-28 14:52:54.021] [DEBUG] [AngularTestServerExecutor::SimpleProcess]: Process 22ynlywnbur - process spawned successfully with PID 21565 for command: /home/ubuntu/.nodenv/shims/node /c/Projects/cirium-profiles/src/frontend/node_modules/@angular/cli/bin/ng test cirium-profiles --karma-config=/home/ubuntu/.vscode-server/extensions/lucono.karma-test-explorer-0.8.2/dist/karma.conf.cjs --progress=false --no-watch
[2023-04-28 14:52:54.033] [INFO] [KarmaTestListener]: Waiting for Karma to connect on port 9999
[2023-04-28 14:53:01.987] [DEBUG] [SimpleFileHandler]: Resolved 45 file(s) from file patterns: ["**/*{.,-,_}{test,spec}.{ts,js}","**/{test,spec}{.,-,_}*.{ts,js}"]
[2023-04-28 14:53:01.989] [DEBUG] [TestLocator]: Requested --> filtered file count to refresh: 45 --> 45
[2023-04-28 14:53:01.989] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/app-config.service.spec.ts
[2023-04-28 14:53:02.036] [DEBUG] [AstTestFileParser]: Parse operation sz867vnqogc: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/app-config.service.spec.ts' in 0.04 secs
[2023-04-28 14:53:02.036] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/app-user.service.spec.ts
[2023-04-28 14:53:02.063] [DEBUG] [AstTestFileParser]: Parse operation 0tflee74mb4a: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/app-user.service.spec.ts' in 0.03 secs
[2023-04-28 14:53:02.063] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/app.component.spec.ts
[2023-04-28 14:53:02.094] [DEBUG] [AstTestFileParser]: Parse operation 7ylaibmw07: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/app.component.spec.ts' in 0.02 secs
[2023-04-28 14:53:02.094] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/script-injector-service.spec.ts
[2023-04-28 14:53:02.111] [DEBUG] [AstTestFileParser]: Parse operation xkczgl4wdf: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/script-injector-service.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.111] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/helpers/browserHelpers.spec.ts
[2023-04-28 14:53:02.127] [DEBUG] [AstTestFileParser]: Parse operation 75fyhodfx55: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/helpers/browserHelpers.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.128] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/helpers/functionalHelpers.spec.ts
[2023-04-28 14:53:02.178] [DEBUG] [AstTestFileParser]: Parse operation 4gerfftp4ip: Parsed 18 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/helpers/functionalHelpers.spec.ts' in 0.05 secs
[2023-04-28 14:53:02.178] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/helpers/profilesHelpers.spec.ts
[2023-04-28 14:53:02.212] [DEBUG] [AstTestFileParser]: Parse operation 3qbddkot7jv: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/helpers/profilesHelpers.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.212] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/helpers/aircraftRoutesHelpers.spec.ts
[2023-04-28 14:53:02.219] [DEBUG] [AstTestFileParser]: Parse operation lmk1repmyvi: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/helpers/aircraftRoutesHelpers.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.219] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/news/helpers/newsHelpers.spec.ts
[2023-04-28 14:53:02.235] [DEBUG] [AstTestFileParser]: Parse operation 9p64y56rcw: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/news/helpers/newsHelpers.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.235] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/analytics/analytics-service.spec.ts
[2023-04-28 14:53:02.246] [DEBUG] [AstTestFileParser]: Parse operation p0kna1grnm: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/analytics/analytics-service.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.247] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/news/services/news-shared-data.service.spec.ts
[2023-04-28 14:53:02.277] [DEBUG] [AstTestFileParser]: Parse operation i5k5tg0r2s: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/news/services/news-shared-data.service.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.277] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/services/profiles-excel-data-service.spec.ts
[2023-04-28 14:53:02.308] [DEBUG] [AstTestFileParser]: Parse operation lrq9xlf8d69: Parsed 6 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/services/profiles-excel-data-service.spec.ts' in 0.02 secs
[2023-04-28 14:53:02.308] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/services/profiles-preferences-service.spec.ts
[2023-04-28 14:53:02.326] [DEBUG] [AstTestFileParser]: Parse operation 7ikx5hq7xq: Parsed 12 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/services/profiles-preferences-service.spec.ts' in 0.02 secs
[2023-04-28 14:53:02.326] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/components/aircraft-routes-metric-toggle/aircraft-routes-metric-toggle.component.spec.ts
[2023-04-28 14:53:02.330] [DEBUG] [AstTestFileParser]: Parse operation kyrqwyqpox: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/components/aircraft-routes-metric-toggle/aircraft-routes-metric-toggle.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.330] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/components/aircraft-routes-metrics/aircraft-routes-metrics.component.spec.ts
[2023-04-28 14:53:02.332] [DEBUG] [AstTestFileParser]: Parse operation szq2izk6di8: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/aircraft-routes/components/aircraft-routes-metrics/aircraft-routes-metrics.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.332] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-chart/ground-events-chart.component.spec.ts
[2023-04-28 14:53:02.356] [DEBUG] [AstTestFileParser]: Parse operation ebxiee8so4r: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-chart/ground-events-chart.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.356] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-grouping/ground-events-grouping.component.spec.ts
[2023-04-28 14:53:02.361] [DEBUG] [AstTestFileParser]: Parse operation c5zummzt7h9: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-grouping/ground-events-grouping.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.361] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-shortcuts/home-shortcuts.component.spec.ts
[2023-04-28 14:53:02.365] [DEBUG] [AstTestFileParser]: Parse operation 73egbtpkg5r: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-shortcuts/home-shortcuts.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.365] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-tab/ground-events-tab.component.spec.ts
[2023-04-28 14:53:02.368] [DEBUG] [AstTestFileParser]: Parse operation zu23fnxlxvo: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/ground-events/components/ground-events-tab/ground-events-tab.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.368] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-tab/home-tab.component.spec.ts
[2023-04-28 14:53:02.370] [DEBUG] [AstTestFileParser]: Parse operation jjl6pki8d8: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-tab/home-tab.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.370] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-table/home-table.component.spec.ts
[2023-04-28 14:53:02.378] [DEBUG] [AstTestFileParser]: Parse operation 6shnfjnzy4: Parsed 8 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/home/components/home-table/home-table.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.378] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-details-table/fleet-details-table.component.spec.ts
[2023-04-28 14:53:02.390] [DEBUG] [AstTestFileParser]: Parse operation mjj2uvbmzb: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-details-table/fleet-details-table.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.390] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-details-table/fleet-details-table.service.spec.ts
[2023-04-28 14:53:02.419] [DEBUG] [AstTestFileParser]: Parse operation s7dworyxm9: Parsed 10 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-details-table/fleet-details-table.service.spec.ts' in 0.03 secs
[2023-04-28 14:53:02.419] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-grouping/fleet-grouping.component.spec.ts
[2023-04-28 14:53:02.422] [DEBUG] [AstTestFileParser]: Parse operation z0z84e25d5d: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-grouping/fleet-grouping.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.422] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-jitter-chart/fleet-jitter-chart.service.spec.ts
[2023-04-28 14:53:02.438] [DEBUG] [AstTestFileParser]: Parse operation 64eyt3kga66: Parsed 6 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-jitter-chart/fleet-jitter-chart.service.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.438] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar-age.service.spec.ts
[2023-04-28 14:53:02.442] [DEBUG] [AstTestFileParser]: Parse operation o9s9c1v5su: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar-age.service.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.442] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar.component.spec.ts
[2023-04-28 14:53:02.448] [DEBUG] [AstTestFileParser]: Parse operation 6ehwnomxoj3: Parsed 2 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.448] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar.service.spec.ts
[2023-04-28 14:53:02.456] [DEBUG] [AstTestFileParser]: Parse operation ocqadjabpl: Parsed 4 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-progress-bar/fleet-progress-bar.service.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.456] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-stacked-bar-chart/fleet-stacked-bar-chart.service.spec.ts
[2023-04-28 14:53:02.485] [DEBUG] [AstTestFileParser]: Parse operation a24b2qqzvf: Parsed 10 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-stacked-bar-chart/fleet-stacked-bar-chart.service.spec.ts' in 0.02 secs
[2023-04-28 14:53:02.485] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-summary-counts/fleet-summary-counts.component.spec.ts
[2023-04-28 14:53:02.493] [DEBUG] [AstTestFileParser]: Parse operation 4f9jslv7uif: Parsed 8 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-summary-counts/fleet-summary-counts.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.494] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-article/news-article.component.spec.ts
[2023-04-28 14:53:02.503] [DEBUG] [AstTestFileParser]: Parse operation odycq0fwgi: Parsed 4 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-article/news-article.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.503] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-age-table.service.spec.ts
[2023-04-28 14:53:02.505] [DEBUG] [AstTestFileParser]: Parse operation cqjeuakdqf: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-age-table.service.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.505] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-table.component.spec.ts
[2023-04-28 14:53:02.509] [DEBUG] [AstTestFileParser]: Parse operation 5js3sdauqvq: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-table.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.509] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-table.service.spec.ts
[2023-04-28 14:53:02.519] [DEBUG] [AstTestFileParser]: Parse operation sj70tmur9dp: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/fleets/components/fleet-table/fleet-table.service.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.519] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-articles/news-articles.component.spec.ts
[2023-04-28 14:53:02.525] [DEBUG] [AstTestFileParser]: Parse operation 21exhmrqynb: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-articles/news-articles.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.525] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-tab/news-tab.component.spec.ts
[2023-04-28 14:53:02.527] [DEBUG] [AstTestFileParser]: Parse operation dazn2of7cf: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/news/components/news-tab/news-tab.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.527] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-header/profiles-header.component.spec.ts
[2023-04-28 14:53:02.532] [DEBUG] [AstTestFileParser]: Parse operation 1lugfcv117g: Parsed 3 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-header/profiles-header.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.532] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/displayed-filter-options.pipe.spec.ts
[2023-04-28 14:53:02.539] [DEBUG] [AstTestFileParser]: Parse operation aoo63woqf9c: Parsed 5 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/displayed-filter-options.pipe.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.539] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/profiles-filter.component.spec.ts
[2023-04-28 14:53:02.542] [DEBUG] [AstTestFileParser]: Parse operation u8v4xybr2pq: Parsed 6 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/profiles-filter.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.542] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/profiles-filter.service.spec.ts
[2023-04-28 14:53:02.569] [DEBUG] [AstTestFileParser]: Parse operation 9lz4fr9nbsv: Parsed 15 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-filter/profiles-filter.service.spec.ts' in 0.03 secs
[2023-04-28 14:53:02.569] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-loading/profiles-loading.component.spec.ts
[2023-04-28 14:53:02.580] [DEBUG] [AstTestFileParser]: Parse operation lnvcyrnq4a9: Parsed 5 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-loading/profiles-loading.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.580] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-notice/profiles-notice.component.spec.ts
[2023-04-28 14:53:02.582] [DEBUG] [AstTestFileParser]: Parse operation kw1gjckg1n9: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-notice/profiles-notice.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.582] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-organization-picker/profiles-organization-picker.component.spec.ts
[2023-04-28 14:53:02.601] [DEBUG] [AstTestFileParser]: Parse operation 4laaft0eyjw: Parsed 10 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-organization-picker/profiles-organization-picker.component.spec.ts' in 0.02 secs
[2023-04-28 14:53:02.602] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-preferences/profiles-preferences.component.spec.ts
[2023-04-28 14:53:02.608] [DEBUG] [AstTestFileParser]: Parse operation dbixippgbyc: Parsed 5 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-preferences/profiles-preferences.component.spec.ts' in 0.01 secs
[2023-04-28 14:53:02.608] [DEBUG] [SimpleFileHandler]: Reading file async: /c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-not-found/profiles-not-found.component.spec.ts
[2023-04-28 14:53:02.610] [DEBUG] [AstTestFileParser]: Parse operation jj4brfqhdlm: Parsed 1 total tests from file '/c/Projects/cirium-profiles/src/frontend/src/app/modules/shared/components/profiles-not-found/profiles-not-found.component.spec.ts' in 0.00 secs
[2023-04-28 14:53:02.610] [DEBUG] [TestLocator]: Refreshed 45 spec files from glob list in 8.88 secs: ["**/*{.,-,_}{test,spec}.{ts,js}","**/{test,spec}{.,-,_}*.{ts,js}"]
[2023-04-28 14:53:17.016] [INFO] [KarmaTestListener]: Established new connection with Karma on port 9999
[2023-04-28 14:53:17.016] [DEBUG] [KarmaTestListener]: Listening for Karma events
[2023-04-28 14:53:17.060] [DEBUG] [KarmaTestRunProcessor]: Ignoring received karma event: file_list_modified
[2023-04-28 14:53:17.331] [DEBUG] [KarmaTestRunProcessor]: Karma server on karma port 9976 is ready for requests
[2023-04-28 14:53:29.910] [ERROR] [KarmaTestRunProcessor]: Failure while listening for test events: Browser Failure - cannot start
[2023-04-28 14:53:29.910] [DEBUG] [KarmaTestRunProcessor]: Test error processing requested with message: Browser Failure - cannot start
[2023-04-28 14:53:29.911] [DEBUG] [KarmaTestListener]: Closing connection with karma
[2023-04-28 14:53:29.911] [DEBUG] [KarmaTestListener]: Cleaning up connections
[2023-04-28 14:53:29.913] [DEBUG] [PortAcquisitionClient]: Releasing ports: 9999
[2023-04-28 14:53:29.914] [ERROR] [DefaultTestManager]: System component terminated with message: Karma server failed to connect: Browser Failure - cannot start
[2023-04-28 14:53:29.914] [DEBUG] [DefaultTestManager]: Test action in progress (System stop was not requested) - Initiating system stop
[2023-04-28 14:53:29.914] [DEBUG] [DefaultTestManager]: Stopping test manager
[2023-04-28 14:53:29.915] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2023-04-28 14:53:29.915] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2023-04-28 14:53:29.915] [ERROR] [DefaultTestManager]: Error: Karma server failed to connect: Browser Failure - cannot start
[2023-04-28 14:53:29.915] [DEBUG] [DefaultTestManager]: Stopping test manager
[2023-04-28 14:53:29.916] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2023-04-28 14:53:29.916] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2023-04-28 14:53:29.916] [ERROR] [KarmaTestExplorer]: Failed to load tests - Karma server failed to connect: Browser Failure - cannot start
[2023-04-28 14:53:29.916] [DEBUG] [NotificationHandler]: Showing 'Error' notification with actions 'Retry Test Load' and message: Failed to load tests - Karma server failed to connect: Browser Failure - cannot start
[2023-04-28 14:53:29.916] [DEBUG] [KarmaTestExplorer]: Updating loaded test store
[2023-04-28 14:53:29.916] [DEBUG] [KarmaTestExplorer]: Clearing loaded root suite
[2023-04-28 14:53:29.916] [DEBUG] [TestStore]: Clearing stored tests
[2023-04-28 14:53:29.918] [INFO] [KarmaTestExplorer]: Finished loading tests in 36.19 secs (Failed)
[2023-04-28 14:53:29.931] [DEBUG] [KarmaTestListener]: Karma connection closed on port 9999
[2023-04-28 14:53:29.932] [DEBUG] [KarmaTestListener]: Done closing karma listener connection
[2023-04-28 14:53:29.932] [DEBUG] [DefaultTestManager]: Stopping karma server
[2023-04-28 14:53:29.932] [INFO] [KarmaTestServer]: Killing Karma server on port 9976
[2023-04-28 14:53:29.933] [DEBUG] [AngularTestServerExecutor::SimpleProcess]: Process 22ynlywnbur - Killing process tree of PID: 21565
[2023-04-28 14:53:30.034] [DEBUG] [DefaultTestManager]: Karma server is already stopped
[2023-04-28 14:53:30.034] [DEBUG] [DefaultTestManager]: Stopped test manager
[2023-04-28 14:53:30.061] [DEBUG] [AngularTestServerExecutor::SimpleProcess]: Process 22ynlywnbur - Successfully killed process tree for PID: 21565
[2023-04-28 14:53:30.080] [DEBUG] [AngularTestServerExecutor::SimpleProcess]: Process 22ynlywnbur - PID 21565 exited with code 'null' and signal 'SIGKILL' for command: /home/ubuntu/.nodenv/shims/node /c/Projects/cirium-profiles/src/frontend/node_modules/@angular/cli/bin/ng test cirium-profiles --karma-config=/home/ubuntu/.vscode-server/extensions/lucono.karma-test-explorer-0.8.2/dist/karma.conf.cjs --progress=false --no-watch
[2023-04-28 14:53:30.080] [DEBUG] [KarmaTestServer]: Karma server process terminated
[2023-04-28 14:53:30.081] [DEBUG] [PortAcquisitionClient]: Releasing ports: 9976
[2023-04-28 14:53:30.081] [DEBUG] [PortAcquisitionClient]: Releasing ports: 9222
[2023-04-28 14:53:30.081] [DEBUG] [KarmaTestServer]: Karma server on port 9976 killed
[2023-04-28 14:53:30.081] [DEBUG] [DefaultTestManager]: Stopped test manager
[2023-04-28 14:53:30.081] [DEBUG] [DefaultTestManager]: System is done stopping
[2023-04-28 14:54:26.056] [DEBUG] [NotificationHandler]: User selected 'Show Log' for 'Error' notification: Failed to load tests - Karma server failed to connect: Browser Failure - cannot start (Click to show log)

Here is the details environment:

  • OS and Version: WSL
  • Environment: WSL
  • Node Version: 16.14.0
  • VS Code Version:
  • Karma Version:
  • Browser and Version:
  • Frameworks: Angular, Jasmine
  • Angular Version (if using Angular):

I am new to the Karma as well as Angular so could you support me?

Thank you

lucono commented

@doantranthanh Can you also attach the logs from the Karma Server ... output channel when the issue occurs.

Also, are you able to successfully run the tests directly from the command line in WSL, without VS Code?

yeah sure

here is the log file

karmar-test-explorer.log

yeah I can run directly from the command line with the following steps:

  • Download and install Chrome:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb

  • Add alias in .bashrc

alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe'
export CHROME_BIN=chrome

it is working but I want to run individual tests so I installed the extension. However, it does not work. I have no idea why.

Thank you

lucono commented

The log you attached is the one for the extension, not for Karma. To get the Karma log, first set the karmaTestExplorer.karmaLogLevel setting to debug and re-open your project. Then when the issue occurs, switch to the Output panel and expand the drop down on the right side, where you should see an item that starts with Karma Server. Select it and the Karma Logs will be displayed. Here's an example screenshot:

image

Sorry, here is the log.

karmar-test-explorer.log

Thank you

I enabled 'karmaTestExplorer.enableExtension' but I found another error here

karmar-test-explorer.log

It looks like Chrome cannot start.

lucono commented

I see you're installing Chrome in WSL, but then aliasing chrome and CHROME_BIN to point to the Windows installation of Chrome instead of the one you've installed in WSL.

You can try one of the following:

  1. Remove / don't perform the following parts of your Chrome installation steps to see if that resolves the issue:
    alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe'
    export CHROME_BIN=chrome
    
  2. Or if you prefer to keep the above, you can try removing it for just the extension by using the extension setting:
    "karmaTestExplorer.envExclude": ["CHROME_BIN"]
  3. If those don't work or are not preferable, you can try telling the extension to run as if in a container (which will enable the --no-sandbox flag for Chrome):
    "karmaTestExplorer.containerMode": "enabled"
  4. The extension always launches the browser in headless mode by default, but launching the Windows installation of Chrome headlessly is not always supported from WSL. If that's the case here, you can tell the extension to launch in non-headless mode by using the extension setting:
    "karmaTestExplorer.nonHeadlessModeEnabled": true
  5. If none of those work, you can have the extension launch Chrome exactly as from Karma, as that seems to be working for you on the command line (though this option may also remove your ability to debug tests with the extension, but you'll still be able to run them):
    "karmaTestExplorer.browser": "Chrome"

I tried the following setting but it does not work.

"karmaTestExplorer.envExclude": ["CHROME_BIN"]
"karmaTestExplorer.containerMode": "enabled",
"karmaTestExplorer.nonHeadlessModeEnabled": true
"karmaTestExplorer.browser": "Chrome"

Here is the log

[2023-05-01 06:34:42.568] [INFO] [Main]: Activating Karma Test Explorer, v0.8.2
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating file handler
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating workspace configuration resolver
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating project factory
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating config change manager
[2023-05-01 06:34:42.569] [DEBUG] [ConfigChangeManager]: Creating config change subscription
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating preference manager
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating port acquisition manager
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating multi-status display
[2023-05-01 06:34:42.569] [INFO] [Main]: Registering project selection command
[2023-05-01 06:34:42.570] [INFO] [Main]: Registering function execution command
[2023-05-01 06:34:42.570] [INFO] [Main]: Setting initial multi-project context
[2023-05-01 06:34:42.570] [INFO] [Main]: Setting multi-project context to: false
[2023-05-01 06:34:42.570] [INFO] [Main]: Processing initial workspace folders
[2023-05-01 06:34:42.570] [INFO] [Main]: Discovering projects for workspace folders: [
  "/c/Projects/cirium-profiles/src/frontend"
]
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Inspecting workspace folder for testing: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Including projects in workspace folder '/c/Projects/cirium-profiles/src/frontend' - 'karmaTestExplorer.enableExtension' is set to true
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Including projects in workspace folder - One or more inclusion conditions were satisfied: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.573] [DEBUG] [SimpleFileHandler]: Reading file synchronously: /c/Projects/cirium-profiles/src/frontend/angular.json
[2023-05-01 06:34:42.575] [INFO] [ProjectFactory]: Using project type 'angular' (auto-detected) for workspace folder: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.575] [DEBUG] [ProjectFactory]: Angular projects found for workspace folder '/c/Projects/cirium-profiles/src/frontend': cirium-profiles
[2023-05-01 06:34:42.576] [DEBUG] [Main]: Last loaded projects: [
  "/c/Projects/cirium-profiles/src/frontend"
]
[2023-05-01 06:34:42.576] [DEBUG] [Main]: Primary projects: []
[2023-05-01 06:34:42.576] [INFO] [Main]: Registering project: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.576] [INFO] [Main]: Activating adapter for project: /c/Projects/cirium-profiles/src/frontend (frontend: cirium-profiles)
[2023-05-01 06:34:42.585] [INFO] [Main]: Done activating adapter for project: /c/Projects/cirium-profiles/src/frontend (frontend: cirium-profiles)
[2023-05-01 06:34:42.585] [INFO] [Main]: Setting multi-project context to: false
[2023-05-01 06:34:42.586] [INFO] [Main]: Subscribing to config changes for workspace folder: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.586] [INFO] [Main]: Subscribing for subsequent workspace folder additions and removals
[2023-05-01 06:34:42.992] [DEBUG] [PortAcquisitionManager]: Request for 1 port(s) at base port 9976 acquired: 9976
[2023-05-01 06:34:42.992] [TRACE] [PortAcquisitionManager]: Currently assigned ports: 9976
[2023-05-01 06:34:43.005] [DEBUG] [PortAcquisitionManager]: Request for 1 port(s) at base port 9999 acquired: 9999
[2023-05-01 06:34:43.005] [TRACE] [PortAcquisitionManager]: Currently assigned ports: 9976, 9999
[2023-05-01 06:41:10.089] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9999
[2023-05-01 06:41:10.208] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9976

But I got another log which is said that

[2023-05-01 06:41:10.209] [DEBUG] [KarmaTestServer]: Karma server on port 9976 killed
[2023-05-01 06:41:10.209] [DEBUG] [DefaultTestManager]: Stopped test manager
[2023-05-01 06:41:10.209] [DEBUG] [DefaultTestManager]: System is done stopping
[2023-05-01 06:46:02.428] [DEBUG] [NotificationHandler]: User selected 'Show Log' for 'Error' notification: Failed to load tests - Karma server failed to connect: Browser Failure - timeout (Click to show log)

And

------------------------------------
Karma Test Explorer: Launching Karma
------------------------------------

[2023-05-01 06:34:53.741] [DEBUG] [KarmaConfigLoader]: Loading Karma config: /c/Projects/cirium-profiles/src/frontend/karma.conf.js

[2023-05-01 06:34:54.594] [DEBUG] [KarmaConfigLoader]: Using requested karma browser: Chrome

01 05 2023 07:35:09.933:WARN [karma]: No captured browser, open http://localhost:9976/

01 05 2023 07:35:10.003:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9976/
01 05 2023 07:35:10.007:INFO [launcher]: Launching browsers Chrome with concurrency unlimited

01 05 2023 07:35:10.013:INFO [launcher]: Starting browser Chrome

01 05 2023 07:36:40.014:WARN [launcher]: Chrome has not captured in 90000 ms, killing.

01 05 2023 07:36:40.030:INFO [launcher]: Trying to start Chrome again (1/3).

01 05 2023 07:38:10.031:WARN [launcher]: Chrome has not captured in 90000 ms, killing.

01 05 2023 07:38:10.045:INFO [launcher]: Trying to start Chrome again (2/3).

01 05 2023 07:39:40.046:WARN [launcher]: Chrome has not captured in 90000 ms, killing.

01 05 2023 07:39:40.062:INFO [launcher]: Trying to start Chrome again (3/3).

01 05 2023 07:41:10.063:WARN [launcher]: Chrome has not captured in 90000 ms, killing.

01 05 2023 07:41:10.079:ERROR [launcher]: Chrome failed 3 times (timeout). Giving up.

What do you think?

lucono commented
"karmaTestExplorer.envExclude": ["CHROME_BIN"]
"karmaTestExplorer.containerMode": "enabled",
"karmaTestExplorer.nonHeadlessModeEnabled": true
"karmaTestExplorer.browser": "Chrome"

Try those options only one at a time, not all together.

also, as you can see in my karma.config.js. I have a custom launch browser which is

customLaunchers: {
      chrome_no_sandbox: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox',
          '--disable-dev-shm-usage',
          '--disable-setuid-sandbox',
          '--disable-gpu',
        ],
      },
    },

I tried to use that but it does not work

"karmaTestExplorer.envExclude": ["CHROME_BIN"]
"karmaTestExplorer.browser": "chrome_no_sandbox"

The issue is

[2023-05-01 07:02:23.816] [DEBUG] [KarmaConfigLoader]: Using requested karma browser: chrome_no_sandbox

01 05 2023 08:02:35.821:WARN [karma]: No captured browser, open http://localhost:9976/

01 05 2023 08:02:35.848:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9976/
01 05 2023 08:02:35.848:INFO [launcher]: Launching browsers chrome_no_sandbox with concurrency unlimited
01 05 2023 08:02:35.853:INFO [launcher]: Starting browser ChromeHeadless

01 05 2023 08:02:37.118:INFO [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Connected on socket jwfgE4LP6g2kh0yiAAAB with id 2349155

01 05 2023 08:02:41.021:WARN [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Disconnected (0 times) Client disconnected from CONNECTED state (transport close)

Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
  Disconnected Client disconnected from CONNECTED state (transport close)
"karmaTestExplorer.browser": "Chrome"

yeah I tried each option at a time but it does not work

lucono commented

Without setting the CHROME_BIN variable, are you able to successfully run the tests from the command line using the same custom launcher?

ng test --browsers=chrome_no_sandbox

I got this error

image

 Browser application bundle generation complete.
##teamcity[blockOpened name='JavaScript Unit Tests' flowId='']
01 05 2023 09:22:10.044:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
01 05 2023 09:22:10.047:INFO [launcher]: Launching browsers chrome_no_sandbox with concurrency unlimited
01 05 2023 09:22:10.053:INFO [launcher]: Starting browser ChromeHeadless
01 05 2023 09:22:14.456:INFO [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Connected on socket GTJs-cV6y174YQhkAAAB with id 31457210
01 05 2023 09:22:25.745:WARN [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Disconnected (0 times) reconnect failed before timeout of 2000ms (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
  Disconnected reconnect failed before timeout of 2000ms (transport close)

Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
  Disconnected reconnect failed before timeout of 2000ms (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
  Disconnected reconnect failed before timeout of 2000ms (transport close)

let me try to update puppeteer. Here is the current versions

 "karma": "^6.3.20",
    "karma-chrome-launcher": "^3.1.1",
    "karma-coverage": "^2.2.0",
    "karma-jasmine": "^5.0.1",
    "karma-jasmine-html-reporter": "^1.7.0",
    "karma-teamcity-reporter": "^1.1.0",
    "protractor": "~7.0.0",
    "puppeteer": "^14.1.1",

I tried to run with new puppeteer

ng test --browsers=chrome_no_sandbox

but i have same issue

Ah if I run

npm rebuild

Then I can run successfully

ng test --browsers=chrome_no_sandbox

YaY

It is working now with the following settings.

"karmaTestExplorer.logLevel" : "debug",
    "karmaTestExplorer.envExclude": ["CHROME_BIN"],
    "karmaTestExplorer.browser": "chrome_no_sandbox"

I can see the unit tests in my VS Code

So I am going to remove CHROME_BIN from my bashrc, and try to use the extension and will let you know if there are any issues

image

Thank you so much for your support

I tried to run and debug a test but it does not work due to

2023-05-01 09:23:30.750] [ERROR] [DefaultTestManager]: System component terminated with message: Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Test action in progress (System stop was not requested) - Initiating system stop
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Stopping test manager
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2023-05-01 09:23:30.750] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2023-05-01 09:23:30.750] [ERROR] [KarmaTestRunProcessor]: Could not capture Karma events - Test execution failed: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.752] [ERROR] [KarmaTestExplorer]: Failed while running requested tests - Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.752] [DEBUG] [NotificationHandler]: Showing 'Error' notification with actions 'Retry Test Run' and message: Failed while running requested tests - Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)

Why running ng test --browsers=chrome_no_sandbox is working

Sorry running ng test --browsers=chrome_no_sandbox is having same issue

Chrome Headless 112.0.5614.0 (Linux x86_64) ERROR
  Disconnected reconnect failed before timeout of 2000ms (transport close)

I think I can load the tests with the extension which is good.

image

However, I dont know what the grey icons mean. Can you explain?

Also, when I tried to run a single test it returns the following log

karmar-test-explorer.log

And when I tried to run the second time, I got the above issues.

What do you think? thanks

lucono commented

Sorry running ng test --browsers=chrome_no_sandbox is having same issue

If you are running into the same issue while running from the command line, then the issue is with your setup and not with the extension. I suspect if you do not alias chrome / CHROME_BIN to point to the Windows installation of Chrome (instead of the one you've installed in WSL), then you should be able to remove all the extension settings you had above (including karmaTestExplorer.browser) and the extension should work by default for both testing and debugging.

I actually can run it with docker-compose command line. So basically, we build and start the frontend container and run ng lint && ng test --code-coverage. I will try it tomorrow then and will let you know.

Thank you for your supports

Not sure if this is related, but I'm getting multiple errors and erratic behaviour in vscode after updating to the latest release (1.77.3), and I'm on Ubuntu 22.04.2 LTS. CPU goes to 100% and when I kill vscode and run top I see a lot of tests still running. After completely uninstalling the extension it seems to be back to normal.

This is what I have about vscode:

Version: 1.77.3
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:52.732Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 5.15.0-71-generic snap
Sandboxed: No

let me try.

My problem is that atm test is running well either inside container (I have a shell script to start a container and run ng test inside container) or run with Chrome browser with setup in .bashrc an alias which is point to chrome.exe in C drive, for example

  • Download and install Chrome:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb

  • Add alias in .bashrc
    alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe'
    export CHROME_BIN=chrome

  • run ng test --browsers=Chrome

Now I can run outside the container with above steps. But I dont know how to integrate with karma extension so I can run individual test in VScode.

lucono commented

@digeomel Open a separate issue and provide all the relevant details. Be sure to provide a minimal reproduction project that shows the issue.

lucono commented

@doantranthanh converting this to a discussion as it seems to be difficulties with your particular setup rather than an issue with the extension.