DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.