Karma.js, Headless Chrome and Docker
Andrei
Posted on March 3, 2018
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…
- remove Phantomjs from your package.json
add dependencies to puppeteer and karma-chrome-launcher
update karma.conf.js according to the snippet below
- 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!
💖 💪 🙅 🚩
Andrei
Posted on March 3, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.