Skip to content

🐞 Issue: --user-data-dir flag causes Chrome login prompt under org policies #291

@newway-anshul

Description

@newway-anshul

Description

Recently, our organization updated its Chrome policies to disallow launching Chrome without user login.
As a result, when running unit tests via Karma with karma-chrome-launcher, Chrome now prompts for login and immediately shuts down — making automated testing impossible.

After debugging, we found that karma-chrome-launcher internally uses the --user-data-dir flag by default when launching Chrome.
When we manually removed this flag, tests ran successfully without the login prompt.

💡 Suggestion / Feature Request
Please add an option (e.g. in karma.conf.js) to control whether the --user-data-dir flag is used.
Something like:

browsers: ['ChromeCustom'],
customLaunchers: {
  ChromeCustom: {
    base: 'Chrome',
    flags: ['--no-sandbox'],
    useUserDataDir: false // new option
  }
}

🔍 Why this matters
Some corporate environments enforce Chrome login policies.
In such environments, the default --user-data-dir behavior breaks headless/automated runs.
Giving users control over this flag would make the launcher more flexible and enterprise-friendly.

🧩 Environment
Angular version: [16.x]
karma-chrome-launcher version: [3.1.0]
OS: [Windows 10]
Chrome version: [141.0.x (enterprise-managed)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions