Files
memecoin-botV2/.pnpm-store/v10/files/2e/f3c06ae9857ec1644135c3c12226820c74754729c3f7b44fff97b127c5b9cb7f7ff414db60245590982ca0c1f35a89d86329fa52523747b7a52d398b48d473

36 lines
692 B
Plaintext

'use strict'
const { test } = require('node:test')
const { createWarning } = require('../')
const { withResolvers } = require('./promise')
test('emit should set the emitted state', t => {
t.plan(3)
const { promise, resolve } = withResolvers()
process.on('warning', onWarning)
function onWarning () {
t.fail('should not be called')
}
const warn = createWarning({
name: 'TestDeprecation',
code: 'CODE',
message: 'Hello world'
})
t.assert.ok(!warn.emitted)
warn.emitted = true
t.assert.ok(warn.emitted)
warn()
t.assert.ok(warn.emitted)
setImmediate(() => {
process.removeListener('warning', onWarning)
resolve()
})
return promise
})