DEV Community

Andrei
Andrei

Posted on

Karma.js, Headless Chrome and Docker

Today I’ve come back to frontend project I’m involved. I have no idea what have happened while I was away for different things but our Karma.js tests stop working.

The project is done with Vue.js and it becomes for some reason impossible to pass slots to the components as strings. Well. And there was error message suggesting to use Puppeteer instead.

And here is a short snippet to how actually do that. Quick notice, I run my tests inside Docker container…

  1. remove Phantomjs from your package.json
  2. add dependencies to puppeteer and karma-chrome-launcher

  3. update karma.conf.js according to the snippet below

  1. also Chrome requires some system libraries and doesn’t work on default nodejs Docker image. So, I’ve found geekykaran/headless-chrome-node-docker.

And after all that changes my tests are green again!

Top comments (0)