# Can't test my Angular App with Karma and Jasmine

**URL:** https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432
**Category:** General
**Created:** [June 2, 2024, 6:20pm UTC](https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432 "2024-06-02T18:20:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Thunder](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/thunder/32/377_2.png) [@Thunder](https://community.firebasestudio.dev/u/Thunder)
#### Post date: [June 2, 2024, 6:20pm UTC](https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432/1 "2024-06-02T18:20:35Z")

</div>

Hello, I am trying to test my Angular application in Project IDX, but I am encountering this error when I run `ng test`:

```auto
amgularapp-3920773:~/amgularapp$ ng test
✔ Browser application bundle generation complete.
02 06 2024 18:16:39.452:WARN [karma]: No captured browser, open http://localhost:9876/
02 06 2024 18:16:39.502:INFO [karma-server]: Karma v6.4.3 server started at http://localhost:9876/
02 06 2024 18:16:39.507:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
02 06 2024 18:16:39.513:INFO [launcher]: Starting browser Chrome
02 06 2024 18:16:39.514:ERROR [launcher]: No binary for Chrome browser on your platform.
  Please, set "CHROME_BIN" env variable.

```

This is my karma.conf.js:

```auto
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('@angular-devkit/build-angular/plugins/karma')
      ],
      client: {
        clearContext: false
      },
      coverageIstanbulReporter: {
        dir: require('path').join(__dirname, './coverage/nombre-proyecto'),
        reports: ['html', 'lcovonly', 'text-summary'],
        fixWebpackSourcePaths: true
      },
      reporters: ['progress', 'kjhtml'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_DEBUG,
      autoWatch: true,
      browsers: ['CustomChromeHeadless'],
      singleRun: false,
      restartOnFileChange: true,
      browserDisconnectTimeout: 10000,
      browserDisconnectTolerance: 3,
      browserNoActivityTimeout: 60000,
      customLaunchers: {
        CustomChromeHeadless: {
          base: 'ChromeHeadless',
          flags: ['--no-sandbox']
        }
      }
    });
  };

```

---

<div class="post-metadata">

### Author: ![Matias\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/matias_vergara/32/578_2.png) [@Matias\_Vergara](https://community.firebasestudio.dev/u/Matias_Vergara)
#### Post date: [June 20, 2024, 8:37pm UTC](https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432/2 "2024-06-20T20:37:49Z")

</div>

Having the same issue

---

<div class="post-metadata">

### Author: ![Sunny](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/sunny/32/85_2.png) [@Sunny](https://community.firebasestudio.dev/u/Sunny)
#### Post date: [June 25, 2024, 9:01pm UTC](https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432/3 "2024-06-25T21:01:06Z")

</div>

Try installing chromium by adding the following snippet into `dev.nix`

```auto
packages = [
    # What you already have
    pkg.chromium
  ];
env = {
    # What you already have
    CHROME_BIN="/usr/bin/chromium";
  };

```

---

<div class="post-metadata">

### Author: ![msofteng](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/msofteng/32/4123_2.png) [@msofteng](https://community.firebasestudio.dev/u/msofteng)
#### Post date: [February 1, 2025, 4:25am UTC](https://community.firebasestudio.dev/t/cant-test-my-angular-app-with-karma-and-jasmine/432/4 "2025-02-01T04:25:25Z")

</div>

```auto
> angular-app@0.0.0 test
> ng test --no-watch --code-coverage

✔ Browser application bundle generation complete.
30 01 2025 03:56:40.608:INFO [karma-server]: Karma v6.4.4 server started at http://localhost:9876/
30 01 2025 03:56:40.620:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
30 01 2025 03:56:40.628:INFO [launcher]: Starting browser Chrome
30 01 2025 03:56:42.092:ERROR [launcher]: Cannot start Chrome
        [5912:5960:0130/035642.081972:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5912:5912:0130/035642.082476:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5912:5912:0130/035642.082493:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.092:ERROR [launcher]: Chrome stdout: 
30 01 2025 03:56:42.092:ERROR [launcher]: Chrome stderr: [5912:5960:0130/035642.081972:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5912:5912:0130/035642.082476:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5912:5912:0130/035642.082493:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.098:INFO [launcher]: Trying to start Chrome again (1/2).
30 01 2025 03:56:42.257:ERROR [launcher]: Cannot start Chrome
        [5965:5988:0130/035642.250554:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5965:5965:0130/035642.252362:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5965:5965:0130/035642.252384:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.257:ERROR [launcher]: Chrome stdout: 
30 01 2025 03:56:42.258:ERROR [launcher]: Chrome stderr: [5965:5988:0130/035642.250554:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5965:5965:0130/035642.252362:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5965:5965:0130/035642.252384:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.262:INFO [launcher]: Trying to start Chrome again (2/2).
30 01 2025 03:56:42.417:ERROR [launcher]: Cannot start Chrome
        [5995:6019:0130/035642.408742:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5995:5995:0130/035642.411078:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5995:5995:0130/035642.411101:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.418:ERROR [launcher]: Chrome stdout: 
30 01 2025 03:56:42.419:ERROR [launcher]: Chrome stderr: [5995:6019:0130/035642.408742:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[5995:5995:0130/035642.411078:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[5995:5995:0130/035642.411101:ERROR:env.cc(257)] The platform failed to initialize. Exiting.

30 01 2025 03:56:42.423:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.

```
