Search code examples
angularkarma-runnertravis-cigoogle-chrome-headlessangular-test

Travis build failing on "The SUID sandbox helper binary was found, but..."


My Angular app tests are passing locally, however they are failing on travis with the following error:

The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.


Solution

  • I solve the issue by editing my karma.conf.js file and adding the following object to my customLaunchers:

    ChromeHeadlessNoSandbox: {
      base: 'ChromeHeadless',
      flags: ['--no-sandbox']
    }
    

    so my karma.conf.js looks like the following:

    module.exports = function (config) {
      config.set({
        // other parameters...
        browsers                : [
          'ChromeHeadlessNoSandbox'
           // other browsers (if any)
        ],
        customLaunchers: {
          ChromeHeadlessNoSandbox: {
            base: 'ChromeHeadless',
            flags: ['--no-sandbox']
          }
          // other browsers (if any)
        },
      });
    };
    

    then I run my test with --browser=ChromeHeadlessNoSandbox