https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

addamsson

03/04/2020, 3:37 PM
Hi there! I've added the
browser
as a target for my MPP project and I'm getting this error:
Copy code
04 03 2020 16:26:34.829:ERROR [launcher]: No binary for ChromeHeadless browser on your platform.

  Please, set "CHROME_BIN" env variable.
What can I do to fix this? I tried to add chrome as the docs states:
Copy code
browser {
    testTask {
        useKarma {
            useChrome()
        }
    }
}
but I get the same error. How can I make my builds run out of the box (without having to set env variables)?
e

Eivind Nilsbakken

03/04/2020, 3:57 PM
If you don't use browser tests, you can disable them with
browser { testTask { enabled = false } }
. That way, the browser task shouldn't look for a browser binary.
a

addamsson

03/04/2020, 4:00 PM
thanks 👍
e

Eivind Nilsbakken

03/04/2020, 4:00 PM
If you are actually running karma tests though, that's not what you want, but there are a bunch of other pre-configured browsers, according to: https://kotlinlang.org/docs/reference/js-project-setup.html#configuring-test-task
a

addamsson

03/04/2020, 4:03 PM
It worked!
👍
I only have common tests, so JUnit is fine
👍 1
i

Ilya Goncharov [JB]

03/04/2020, 7:27 PM
You need Chrome by default to run tests, you need change browser with
useFirefox
for example Or even you can try to use
useMocha()
instead of
useKarma
a

addamsson

03/04/2020, 7:43 PM
how would this work in a CI environment?
i

Ilya Goncharov [JB]

03/04/2020, 7:47 PM
Mocha will be executed in node environment, karma - is in browser, so browser should be installed in your ci environment
a

addamsson

03/04/2020, 7:55 PM
what if that's not an option?
for example CircleCI is a headless environment
e

Eivind Nilsbakken

03/04/2020, 7:57 PM
On CircleCI you can easily run your pipelines in custom Docker containers with Chromium headless installed. There are hundreds of Docker images on Docker Hub for this exact scenario.
1
a

addamsson

03/04/2020, 7:58 PM
oh, that's nice
thanks
e

Eivind Nilsbakken

03/04/2020, 7:59 PM
If you need Docker-in-Docker, ie build Docker images in a pipeline, you might want to use one of CircleCI's pre-configured images though.
Most modern CI platforms support this. GitLab, Travis, GitHub Actions, etc.
a

addamsson

03/04/2020, 8:07 PM
not right now, but I'll take a look into it if the need arises
e

Eivind Nilsbakken

03/04/2020, 8:17 PM
If so,
circleci/node:latest-browsers
might be a good fit. It has Firefox and Chrome installed (and node+npm, of course).
a

addamsson

03/06/2020, 9:31 AM
👍
thanks
5 Views