Projektstart
This commit is contained in:
29
backend/node_modules/process-warning/test/emit-interpolated-string.test.js
generated
vendored
Normal file
29
backend/node_modules/process-warning/test/emit-interpolated-string.test.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
const test = require('tap').test
|
||||
const { createWarning } = require('..')
|
||||
|
||||
test('emit with interpolated string', t => {
|
||||
t.plan(4)
|
||||
|
||||
process.on('warning', onWarning)
|
||||
function onWarning (warning) {
|
||||
t.equal(warning.name, 'TestDeprecation')
|
||||
t.equal(warning.code, 'CODE')
|
||||
t.equal(warning.message, 'Hello world')
|
||||
t.ok(codeWarning.emitted)
|
||||
}
|
||||
|
||||
const codeWarning = createWarning({
|
||||
name: 'TestDeprecation',
|
||||
code: 'CODE',
|
||||
message: 'Hello %s'
|
||||
})
|
||||
codeWarning('world')
|
||||
codeWarning('world')
|
||||
|
||||
setImmediate(() => {
|
||||
process.removeListener('warning', onWarning)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user