spec: Use multiparty instead of formidable

The latter is buggy and affects our specs.
This commit is contained in:
Cheng Zhao 2015-11-10 16:21:08 +08:00
parent 751af25f37
commit 05611f5e60
3 changed files with 4 additions and 6 deletions

View file

@ -3,7 +3,7 @@ path = require 'path'
http = require 'http' http = require 'http'
url = require 'url' url = require 'url'
remote = require 'remote' remote = require 'remote'
formidable = require 'formidable' multiparty = require 'multiparty'
crashReporter = remote.require 'crash-reporter' crashReporter = remote.require 'crash-reporter'
BrowserWindow = remote.require 'browser-window' BrowserWindow = remote.require 'browser-window'
@ -26,10 +26,8 @@ describe 'crash-reporter module', ->
@timeout 120000 @timeout 120000
server = http.createServer (req, res) -> server = http.createServer (req, res) ->
server.close() server.close()
form = new formidable.IncomingForm() form = new multiparty.Form()
process.throwDeprecation = false
form.parse req, (error, fields, files) -> form.parse req, (error, fields, files) ->
process.throwDeprecation = true
assert.equal fields['prod'], 'Electron' assert.equal fields['prod'], 'Electron'
assert.equal fields['ver'], process.versions['electron'] assert.equal fields['ver'], process.versions['electron']
assert.equal fields['process_type'], 'renderer' assert.equal fields['process_type'], 'renderer'
@ -39,7 +37,6 @@ describe 'crash-reporter module', ->
assert.equal fields['_productName'], 'Zombies' assert.equal fields['_productName'], 'Zombies'
assert.equal fields['_companyName'], 'Umbrella Corporation' assert.equal fields['_companyName'], 'Umbrella Corporation'
assert.equal fields['_version'], require('remote').require('app').getVersion() assert.equal fields['_version'], require('remote').require('app').getVersion()
assert files['upload_file_minidump']['name']?
res.end('abc-123-def') res.end('abc-123-def')
done() done()

View file

@ -5,7 +5,7 @@
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {
"basic-auth": "^1.0.0", "basic-auth": "^1.0.0",
"formidable": "1.0.16", "multiparty": "4.1.2",
"graceful-fs": "3.0.5", "graceful-fs": "3.0.5",
"mocha": "2.1.0", "mocha": "2.1.0",
"q": "0.9.7", "q": "0.9.7",

View file

@ -9,6 +9,7 @@ process.port = 0; // will be used by crash-reporter spec.
app.commandLine.appendSwitch('js-flags', '--expose_gc'); app.commandLine.appendSwitch('js-flags', '--expose_gc');
app.commandLine.appendSwitch('ignore-certificate-errors'); app.commandLine.appendSwitch('ignore-certificate-errors');
app.commandLine.appendSwitch('disable-renderer-backgrounding');
// Accessing stdout in the main process will result in the process.stdout // Accessing stdout in the main process will result in the process.stdout
// throwing UnknownSystemError in renderer process sometimes. This line makes // throwing UnknownSystemError in renderer process sometimes. This line makes