First commit
This commit is contained in:
24
node_modules/on-exit-leak-free/test/fixtures/unregister.js
generated
vendored
Normal file
24
node_modules/on-exit-leak-free/test/fixtures/unregister.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
const { register, unregister } = require('../..')
|
||||
const assert = require('assert')
|
||||
|
||||
function setup () {
|
||||
const obj = { foo: 'bar' }
|
||||
register(obj, shutdown)
|
||||
setImmediate(function () {
|
||||
unregister(obj)
|
||||
unregister(obj) // twice, this should not throw
|
||||
})
|
||||
}
|
||||
|
||||
let shutdownCalled = false
|
||||
function shutdown (obj) {
|
||||
shutdownCalled = true
|
||||
}
|
||||
|
||||
setup()
|
||||
|
||||
process.on('exit', function () {
|
||||
assert.strictEqual(shutdownCalled, false)
|
||||
})
|
||||
Reference in New Issue
Block a user