import Client from '../../client.js';
import { enterJob } from '../../../utils/buildmessage.js';
import { ensureDependencies } from '../../../cli/dev-bundle-helpers.js';

const NPM_DEPENDENCIES = {
  puppeteer: '1.3.0'
};

export default class PuppeteerClient extends Client {
  constructor(options) {
    super(options);

    enterJob(
      {
        title: 'Installing Puppeteer in Meteor tool'
      },
      () => {
        ensureDependencies(NPM_DEPENDENCIES);
      }
    );

    this.npmPackageExports = require('puppeteer');

    this.name = 'Puppeteer';
  }

  async connect() {
    // Note for Travis and CircleCI to run sandbox must be turned off.
    // This is not ideal, in the future would be worthwhile to configure to include only for CI based setups
    this.browser = await this.npmPackageExports.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] });
    this.page = await this.browser.newPage();
    this.page.goto(`http://${this.host}:${this.port}`);
  }

  stop() {
    this.browser && this.browser.close();
    this.browser = null;
  }

  static pushClients(clients, appConfig) {
    clients.push(new PuppeteerClient(appConfig));
  }
}

import Client from '../../client.js';
import { enterJob } from '../../../utils/buildmessage.js';
import { ensureDependencies } from '../../../cli/dev-bundle-helpers.js';

const NPM_DEPENDENCIES = {
  puppeteer: '1.3.0'
};

export default class PuppeteerClient extends Client {
  constructor(options) {
    super(options);

    enterJob(
      {
        title: 'Installing Puppeteer in Meteor tool'
      },
      () => {
        ensureDependencies(NPM_DEPENDENCIES);
      }
    );

    this.npmPackageExports = require('puppeteer');

    this.name = 'Puppeteer';
  }

  async connect() {
    // Note for Travis and CircleCI to run sandbox must be turned off.
    // From a security perspective this is not ideal, in the future would be worthwhile 
    // to configure to include only for CI based setups
    this.browser = await this.npmPackageExports.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] });
    this.page = await this.browser.newPage();
    this.page.goto(`http://${this.host}:${this.port}`);
  }

  stop() {
    this.browser && this.browser.close();
    this.browser = null;
  }

  static pushClients(clients, appConfig) {
    clients.push(new PuppeteerClient(appConfig));
  }
}

Fix comment