test: move debugger spec to main process (#20514)
This commit is contained in:
parent
5c2c30142c
commit
1f44f47de1
2 changed files with 16 additions and 19 deletions
|
@ -50,7 +50,7 @@ Returns:
|
|||
|
||||
* `event` Event
|
||||
* `method` String - Method name.
|
||||
* `params` unknown - Event parameters defined by the 'parameters'
|
||||
* `params` any - Event parameters defined by the 'parameters'
|
||||
attribute in the remote debugging protocol.
|
||||
|
||||
Emitted whenever the debugging target issues an instrumentation event.
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const http = require('http')
|
||||
const path = require('path')
|
||||
const { emittedOnce } = require('./events-helpers')
|
||||
const { closeWindow } = require('./window-helpers')
|
||||
const { BrowserWindow } = require('electron').remote
|
||||
|
||||
const { expect } = chai
|
||||
chai.use(dirtyChai)
|
||||
import { expect } from 'chai'
|
||||
import * as http from 'http'
|
||||
import * as path from 'path'
|
||||
import { AddressInfo } from 'net'
|
||||
import { BrowserWindow } from 'electron'
|
||||
import { closeAllWindows } from './window-helpers'
|
||||
import { emittedOnce } from './events-helpers'
|
||||
|
||||
describe('debugger module', () => {
|
||||
const fixtures = path.resolve(__dirname, 'fixtures')
|
||||
let w = null
|
||||
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
||||
let w: BrowserWindow
|
||||
|
||||
beforeEach(() => {
|
||||
w = new BrowserWindow({
|
||||
|
@ -21,7 +18,7 @@ describe('debugger module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
afterEach(() => closeWindow(w).then(() => { w = null }))
|
||||
afterEach(closeAllWindows)
|
||||
|
||||
describe('debugger.attach', () => {
|
||||
it('succeeds when devtools is already open', done => {
|
||||
|
@ -87,19 +84,19 @@ describe('debugger module', () => {
|
|||
})
|
||||
w.webContents.debugger.on('detach', (e, reason) => {
|
||||
expect(w.webContents.debugger.isAttached()).to.be.false()
|
||||
expect(w.devToolsWebContents.isDestroyed()).to.be.false()
|
||||
expect((w as any).devToolsWebContents.isDestroyed()).to.be.false()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('debugger.sendCommand', () => {
|
||||
let server
|
||||
let server: http.Server
|
||||
|
||||
afterEach(() => {
|
||||
if (server != null) {
|
||||
server.close()
|
||||
server = null
|
||||
server = null as any
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -193,7 +190,7 @@ describe('debugger module', () => {
|
|||
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
w.webContents.debugger.sendCommand('Network.enable')
|
||||
w.loadURL(`http://127.0.0.1:${server.address().port}`)
|
||||
w.loadURL(`http://127.0.0.1:${(server.address() as AddressInfo).port}`)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -219,7 +216,7 @@ describe('debugger module', () => {
|
|||
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
w.webContents.debugger.sendCommand('Network.enable')
|
||||
w.loadURL(`http://127.0.0.1:${server.address().port}`)
|
||||
w.loadURL(`http://127.0.0.1:${(server.address() as AddressInfo).port}`)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue