Wait for crash report to become available
This commit is contained in:
parent
30c6ca6751
commit
4a8dcec63a
1 changed files with 23 additions and 4 deletions
|
@ -61,10 +61,12 @@ describe('crashReporter module', function () {
|
||||||
|
|
||||||
const reportId = 'abc-123-def-456-abc-789-abc-123-abcd'
|
const reportId = 'abc-123-def-456-abc-789-abc-123-abcd'
|
||||||
res.end(reportId, () => {
|
res.end(reportId, () => {
|
||||||
assert.equal(crashReporter.getLastCrashReport().id, reportId)
|
waitForCrashReport().then(() => {
|
||||||
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
assert.equal(crashReporter.getLastCrashReport().id, reportId)
|
||||||
assert.equal(crashReporter.getUploadedReports()[0].id, reportId)
|
assert.notEqual(crashReporter.getUploadedReports().length, 0)
|
||||||
done()
|
assert.equal(crashReporter.getUploadedReports()[0].id, reportId)
|
||||||
|
done()
|
||||||
|
}, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -116,3 +118,20 @@ describe('crashReporter module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const waitForCrashReport = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let times = 0
|
||||||
|
const checkForReport = () => {
|
||||||
|
if (crashReporter.getLastCrashReport() != null) {
|
||||||
|
resolve()
|
||||||
|
} else if (times >= 10) {
|
||||||
|
reject(new Error('No crash report available'))
|
||||||
|
} else {
|
||||||
|
times++
|
||||||
|
setTimeout(checkForReport, 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkForReport()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue