diff --git a/spec/api-net-spec.js b/spec/api-net-spec.js index e2236438ecab..4b1c2f48afda 100644 --- a/spec/api-net-spec.js +++ b/spec/api-net-spec.js @@ -1,5 +1,6 @@ const assert = require('assert') const {remote} = require('electron') +const {ipcRenderer} = require('electron') const http = require('http') const url = require('url') const {net} = remote @@ -1169,13 +1170,21 @@ describe('net module', function () { server = null }) - it.only('should free unreferenced, never-started request objects', function() { + it.only('should free unreferenced, never-started request objects', function(done) { const requestUrl = '/requestUrl' - const urlRequest = net.request( `${server.url}${requestUrl}`) + ipcRenderer.on('api-net-spec-done', function() { + done() + }) + const testCode = ` + // Load the net module in the main browser process. + const {net} = require('electron') + const urlRequest = net.request('${server.url}${requestUrl}') process.nextTick(function() { net._RequestGarbageCollectionForTesting() - process.nextTick(done) + event.sender.send('api-net-spec-done') }) + ` + ipcRenderer.send('eval', testCode) }) it.skip('should not collect on-going requests', function(done) { assert(false) @@ -1183,5 +1192,5 @@ describe('net module', function () { it.skip('should collect unreferenced, ended requests', function(done) { assert(false) }) - } + }) }) diff --git a/spec/static/main.js b/spec/static/main.js index e910e4de2cd5..9a30fd8170b9 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -8,6 +8,7 @@ const ipcMain = electron.ipcMain const dialog = electron.dialog const BrowserWindow = electron.BrowserWindow const protocol = electron.protocol +const v8 = require('v8'); const Coverage = require('electabul').Coverage const fs = require('fs') @@ -24,6 +25,7 @@ var argv = require('yargs') var window = null process.port = 0 // will be used by crash-reporter spec. +v8.setFlagsFromString('--expose_gc') app.commandLine.appendSwitch('js-flags', '--expose_gc') app.commandLine.appendSwitch('ignore-certificate-errors') app.commandLine.appendSwitch('disable-renderer-backgrounding')