<commit_before>const assert = require('assert')
const childProcess = require('child_process')
const http = require('http')
const multiparty = require('multiparty')
const path = require('path')
const temp = require('temp').track()
const url = require('url')
const {closeWindow} = require('./window-helpers')

const {remote} = require('electron')
const {app, BrowserWindow, crashReporter} = remote.require('electron')

const isCI = remote.getGlobal('isCi')

describe('crashReporter module', function () {
  var fixtures = path.resolve(__dirname, 'fixtures')
  var w = null
  var originalTempDirectory = null
  var tempDirectory = null

  beforeEach(function () {
    w = new BrowserWindow({
      show: false
    })
    tempDirectory = temp.mkdirSync('electronCrashReporterSpec-')
    originalTempDirectory = app.getPath('temp')
    app.setPath('temp', tempDirectory)
  })

  afterEach(function () {
    app.setPath('temp', originalTempDirectory)
    return closeWindow(w).then(function () { w = null })
  })

  if (process.mas) {
    return
  }

  it('should send minidump when renderer crashes', function (done) {
    if (isCI) return done()

    this.timeout(120000)

    startServer({
      callback (port) {
        const crashUrl = url.format({
          protocol: 'file',
          pathname: path.join(fixtures, 'api', 'crash.html'),
          search: '?port=' + port
        })
        w.loadURL(crashUrl)
      },
      processType: 'renderer',
      done: done
    })
  })

  it('should send minidump when node processes crash', function (done) {
    if (isCI) return done()

    this.timeout(120000)

    startServer({
      callback (port) {
        const crashesDir = path.join(app.getPath('temp'), `${app.getName()} Crashes`)
        const version = app.getVersion()
        const crashPath = path.join(fixtures, 'module', 'crash.js')
        childProcess.fork(crashPath, [port, version, crashesDir], {silent: true})
      },
      processType: 'browser',
      done: done
    })
  })<commit_msg>Run crash reporter server specs on CI<commit_after>const assert = require('assert')
const childProcess = require('child_process')
const http = require('http')
const multiparty = require('multiparty')
const path = require('path')
const temp = require('temp').track()
const url = require('url')
const {closeWindow} = require('./window-helpers')

const {remote} = require('electron')
const {app, BrowserWindow, crashReporter} = remote.require('electron')

describe('crashReporter module', function () {
  var fixtures = path.resolve(__dirname, 'fixtures')
  var w = null
  var originalTempDirectory = null
  var tempDirectory = null

  beforeEach(function () {
    w = new BrowserWindow({
      show: false
    })
    tempDirectory = temp.mkdirSync('electronCrashReporterSpec-')
    originalTempDirectory = app.getPath('temp')
    app.setPath('temp', tempDirectory)
  })

  afterEach(function () {
    app.setPath('temp', originalTempDirectory)
    return closeWindow(w).then(function () { w = null })
  })

  if (process.mas) {
    return
  }

  it('should send minidump when renderer crashes', function (done) {
    if (process.platform !== 'darwin') return done()
    if (process.env.TRAVIS === 'true') return done()

    this.timeout(120000)

    startServer({
      callback (port) {
        const crashUrl = url.format({
          protocol: 'file',
          pathname: path.join(fixtures, 'api', 'crash.html'),
          search: '?port=' + port
        })
        w.loadURL(crashUrl)
      },
      processType: 'renderer',
      done: done
    })
  })

  it('should send minidump when node processes crash', function (done) {
    if (process.platform !== 'darwin') return done()
    if (process.env.TRAVIS === 'true') return done()

    this.timeout(120000)

    startServer({
      callback (port) {
        const crashesDir = path.join(app.getPath('temp'), `${app.getName()} Crashes`)
        const version = app.getVersion()
        const crashPath = path.join(fixtures, 'module', 'crash.js')
        childProcess.fork(crashPath, [port, version, crashesDir], {silent: true})
      },
      processType: 'browser',
      done: done
    })
  })
{'fraction_non_alphanumeric': 0.14385374067837384, 'fraction_numerical': 0.005773394274717345, 'mean_word_length': 3.326742976066597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1761299', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1230, 'n_words': 307}