Niko
Niko

Reputation: 810

Run Angular unit tests using Karma/Jasmine on multi-arch Docker containers

I have some Angular unit tests developed on Jasmine and using Karma runner. I can easily run them locally on an M2 Mac but now I am developing a CI pipeline which runs the tests on arm64 and amd64 images. My problem is that so far I cannot find a Karma launcher or browser that can support different architectures:

  1. Google Chrome is only package for amd64 and not available on arm
  2. Chromium and Firefox break with
Command '/usr/bin/<firefox_or_chromium>' requires the firefox_or_chromium snap to be installed.
Please install it with:

snap install firefox_or_chromium
  1. I tried Puppeteer which uses Chromium on the background but this breaks with
37.55 npm error command sh -c node install.js
37.55 npm error The chromium binary is not available for arm64.
37.55 npm error If you are on Ubuntu, you can install with:
37.55 npm error
37.55 npm error  sudo apt install chromium
37.55 npm error
37.55 npm error
37.55 npm error  sudo apt install chromium-browser

On every approach, I adjusted my package.json and karma.config.json to support the corresponding headless browser configuration but my main issue is that the binaries in the end were breaking. Although for Firefox and Chromium, nothing broke on build time - which is sneaky - especially considering the time QEMO takes to build these multi-arch images.

I just want to run some plain unit tests. No browser automation, no Selenium integration. Nothing fancy. I just need a browser that can be used on both arm and amd Linux images.

Upvotes: 0

Views: 56

Answers (0)

Related Questions