Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted at 11. Aug '21

Jest-pupeteer Remote Debugging

Configuration suited for Alpine Linux running in Docker. When scripts run, open Chromium or Chrome locally and type http://localhost:9222. Set up Docker to map port 9222 to localhost. And then run Pupeteer tests in Jest. You'll be able to see the content of the browser.

var os = require("os");

module.exports = {
  launch: {
    dumpio: false,
    headless: true,
    args:
      os.userInfo().username === "root"
        ? [
            "--disable-infobars",
            "--no-sandbox",
            "--disable-dev-shm-usage",
            "--remote-debugging-port=9222",
            "--remote-debugging-address=0.0.0.0",
          ]
        : ["--disable-infobars"],
  },
  server: {
    command: "pnpm run dev -- --port 3010",
    port: 3010,
    launchTimeout: 10000,
  },
  browserContext: "default",
};

Add Comment