Skip to content

Cannot load browser "EdgeHeadless": it is not registered! #20

@OZZlE

Description

@OZZlE
    ng test --no-watch --no-progress --browsers=EdgeHeadless --code-coverage
    17 04 2024 13:44:58.442:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
    17 04 2024 13:44:58.449:INFO [launcher]: Launching browsers EdgeHeadless with concurrency unlimited
    17 04 2024 13:44:58.450:ERROR [launcher]: Cannot load browser "EdgeHeadless": it is not registered! Perhaps you are missing some plugin?
    17 04 2024 13:44:58.451:ERROR [karma-server]: Error: Found 1 load error
        at Server.<anonymous> (C:\..censored...\node_modules\karma\lib\server.js:243:26)
        at Object.onceWrapper (node:events:632:28)
        at Server.emit (node:events:530:35)
        at Server.emit (node:domain:488:12)
        at emitListeningNT (node:net:1906:10)
        at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

karma.conf.js

// 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-istanbul-reporter"),
      require("@angular-devkit/build-angular/plugins/karma"),
      require('@chiragrupani/karma-chromium-edge-launcher'),
    ],
    client: {
      jasmine: {
        // you can add configuration options for Jasmine here
        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
        // for example, you can disable the random execution with `random: false`
        // or set a specific seed with `seed: 4321`
      },
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
    },
    jasmineHtmlReporter: {
      suppressAll: true, // removes the duplicated traces
    },
    coverageReporter: {
      dir: require("path").join(__dirname, "./coverage/censored"),
      subdir: ".",
      reporters: [
        { type: 'lcov' },
        { type: "html" },
        { type: "text-summary" }
      ],
    },
    reporters: ["progress", "kjhtml"],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Edge', 'EdgeAnyHeadless'],
    customLaunchers: {
      EdgeHeadlessCI: {
        base: "EdgeAnyHeadless",
        flags: ["--no-sandbox"],
      },
    },
    singleRun: false,
    restartOnFileChange: true,
  });
};

package.json (relevant parts)

{
  "name": "censored",
  "private": true,
  "dependencies": {
    "@angular/animations": "^17.0.0",
    "@angular/cdk": "^17.0.0",
    "@angular/common": "^17.0.0",
    "@angular/compiler": "^17.0.0",
    "@angular/core": "^17.0.0",
    "@angular/forms": "^17.0.0",
    "@angular/localize": "^17.0.0",
    "@angular/material": "^17.0.0",
    "@angular/platform-browser": "^17.0.0",
    "@angular/platform-browser-dynamic": "^17.0.0",
    "@angular/router": "^17.0.0",
    "@coreui/angular": "^4.7.0",
    "@fortawesome/angular-fontawesome": "^0.10.2",

    "ngx-toastr": "^16.0.0",
    "puppeteer": "^22.6.5",
    "rxjs": "^7.0.0",
    "tslib": "^2.3.0",
    "typescript": "^5.4.5",
    "zone.js": "~0.14.0"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^17.0.0",
    "@angular-devkit/build-angular": "^17.0.0",
    "@angular/cli": "^17.0.0",
    "@angular/compiler-cli": "^17.0.0",
    "@chiragrupani/karma-chromium-edge-launcher": "^2.3.1",
    "@types/jasmine": "~5.1.4",
    "@types/jest": "^29.5.12",
    "@types/node": "^12.20.42",
    "@types/pdfmake": "^0.2.9",
    "assets-webpack-plugin": "^7.1.1",
    "jasmine-core": "~5.1.2",
    "karma": "^6.4.2",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.1",
    "karma-edgium-launcher": "^4.0.0-0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "prettier": "^3.2.5",
    "webpack": "^5.68.0"
  }
}

I run ng test --no-watch --no-progress --browsers=EdgeHeadless --code-coverage on a windows 11 PC that has Edge

I intend to run it in Github Action on Windows 2019 runner where I dont know path to Edge also...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions