update deprecations spec

This commit is contained in:
Shelley Vohr 2017-10-26 20:35:33 -04:00
parent 83a290a411
commit 6cd308f9ad
No known key found for this signature in database
GPG key ID: F13993A75599653C
2 changed files with 11 additions and 12 deletions

View file

@ -4,7 +4,7 @@ const path = require('path')
const {closeWindow} = require('./window-helpers')
const BrowserWindow = require('electron').remote.BrowserWindow
describe.only('debugger module', () => {
describe('debugger module', () => {
const fixtures = path.resolve(__dirname, 'fixtures')
let w = null

View file

@ -1,27 +1,26 @@
const assert = require('assert')
const deprecations = require('electron').deprecations
const {deprecations, deprecate} = require('electron')
describe('deprecations', function () {
beforeEach(function () {
describe('deprecations', () => {
beforeEach(() => {
deprecations.setHandler(null)
process.throwDeprecation = true
})
it('allows a deprecation handler function to be specified', function () {
var messages = []
it('allows a deprecation handler function to be specified', () => {
const messages = []
deprecations.setHandler(function (message) {
deprecations.setHandler((message) => {
messages.push(message)
})
require('electron').deprecate.log('this is deprecated')
deprecate.log('this is deprecated')
assert.deepEqual(messages, ['this is deprecated'])
})
it('throws an exception if no deprecation handler is specified', function () {
assert.throws(function () {
require('electron').deprecate.log('this is deprecated')
it('throws an exception if no deprecation handler is specified', () => {
assert.throws(() => {
deprecate.log('this is deprecated')
}, /this is deprecated/)
})
})