warn.js 484 B

1234567891011121314151617
  1. 'use strict'
  2. const { Suite } = require('benchmark')
  3. const warning = require('..')()
  4. warning.create('FastifyWarning', 'FST_ERROR_CODE_1', 'message')
  5. warning.create('FastifyWarning', 'FST_ERROR_CODE_2', 'message')
  6. warning.create('FastifyWarning', 'FST_ERROR_CODE_3', 'message')
  7. new Suite()
  8. .add('warn', function () {
  9. warning.emit('FST_ERROR_CODE_1')
  10. warning.emit('FST_ERROR_CODE_3')
  11. })
  12. .on('cycle', function (event) {
  13. console.log(String(event.target))
  14. })
  15. .run()