Hi there! I've added the `browser` as a target for...
# multiplatform
a
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
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
thanks 👍
e
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
It worked!
👍
I only have common tests, so JUnit is fine
👍 1
i
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
how would this work in a CI environment?
i
Mocha will be executed in node environment, karma - is in browser, so browser should be installed in your ci environment
a
what if that's not an option?
for example CircleCI is a headless environment
e
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
oh, that's nice
thanks
e
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
not right now, but I'll take a look into it if the need arises
e
If so,
circleci/node:latest-browsers
might be a good fit. It has Firefox and Chrome installed (and node+npm, of course).
a
👍
thanks