Skip to content

maork-elementor/docker-karma-puppeteer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

docker-lein-doo-karma

Docker image with lein, doo and karma for ClojureScript tests.

There are three runners available with this image

  • chromium-headless
  • nashorn

Dockerfile contents

  • Dockerfile is based on official clojure:lein-2.8.1-alpine
  • Installs Chromium (courtesy of this Dockerfile)
  • Adds wrappers for Chromium to use --no-sandbox and other flags using this technique
  • Installs karma-cli globally
  • Creates WORKDIR at /usr/share/build and installs karma and runners locally
  • Adds profiles.clj with path to karma installation at WORKDIR to be copied to project folder

.gitlab-ci.yml example

# .gitlab-ci.yml
image: ai212983/lein-doo-karma
before_script:
  # copy node modules and profiles.clj to current directory
  - cp -a /usr/share/build/. ./
  # download deps
  - lein deps
test:
  script:
    - lein doo chrome-headless test once
    - lein doo firefox test once

Notes

Nashorn limitations

Nashorn is bundled with official clojure:lein-2.8.1-alpine, which is used as base image. Karma is not required for doo nashorn runner.

Being a JS engine, not browser, Nashorn have no access to DOM. It can't be used if DOM/React related code is compiled into the tests. Even if the tests are not using DOM/React directly, watch out for dependencies.

Puppeteer

Puppeteer is a Node library providing API to control headless Chrome/Chromium via DevTools Protocol.

It is should be a preferable way to interact with Chrome from Node, but to use it with Karma, it is required to customize karma.conf.js.

Doo does not support this, as it generates config file itself.

Credit

This dockerfile is a fork of the original work done by cloudgears in the repo docker-lein-doo-karma

About

Docker image with lein doo and karma for cljs tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 100.0%