Add tests for crash reports in custom temp directory
This commit is contained in:
parent
f282b51c98
commit
1afe501a36
2 changed files with 12 additions and 1 deletions
|
@ -1,7 +1,10 @@
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
|
const fs = require('fs')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const multiparty = require('multiparty')
|
const multiparty = require('multiparty')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const rimraf = require('rimraf')
|
||||||
|
const temp = require('temp').track()
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
const {closeWindow} = require('./window-helpers')
|
const {closeWindow} = require('./window-helpers')
|
||||||
|
|
||||||
|
@ -11,14 +14,20 @@ const {app, BrowserWindow, crashReporter} = remote.require('electron')
|
||||||
describe('crashReporter module', function () {
|
describe('crashReporter module', function () {
|
||||||
var fixtures = path.resolve(__dirname, 'fixtures')
|
var fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
var w = null
|
var w = null
|
||||||
|
var originalTempDirectory = null
|
||||||
|
var tempDirectory = null
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false
|
show: false
|
||||||
})
|
})
|
||||||
|
tempDirectory = temp.mkdirSync('electronCrashReporterSpec-')
|
||||||
|
originalTempDirectory = app.getPath('temp')
|
||||||
|
app.setPath('temp', tempDirectory)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
app.setPath('temp', originalTempDirectory)
|
||||||
return closeWindow(w).then(function () { w = null })
|
return closeWindow(w).then(function () { w = null })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -56,6 +65,7 @@ describe('crashReporter module', function () {
|
||||||
assert.equal(crashReporter.getLastCrashReport().id, 'abc-123-def')
|
assert.equal(crashReporter.getLastCrashReport().id, 'abc-123-def')
|
||||||
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
||||||
assert.equal(crashReporter.getUploadedReports()[0].id, 'abc-123-def')
|
assert.equal(crashReporter.getUploadedReports()[0].id, 'abc-123-def')
|
||||||
|
assert.equal(fs.existsSync(tempDirectory, 'Zombies Crahses'), true)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"basic-auth": "^1.0.0",
|
"basic-auth": "^1.0.0",
|
||||||
"graceful-fs": "3.0.5",
|
"graceful-fs": "3.0.5",
|
||||||
"mocha": "2.1.0",
|
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
|
"mocha": "2.1.0",
|
||||||
"multiparty": "4.1.2",
|
"multiparty": "4.1.2",
|
||||||
"q": "0.9.7",
|
"q": "0.9.7",
|
||||||
|
"rimraf": "^2.5.4",
|
||||||
"temp": "0.8.1",
|
"temp": "0.8.1",
|
||||||
"walkdir": "0.0.7",
|
"walkdir": "0.0.7",
|
||||||
"ws": "0.7.2",
|
"ws": "0.7.2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue