senecajs/seneca

Decoration is bound to the wrong this-ref in v3.30.0

Opened this issue · 0 comments

const Seneca = require('..')

const si = Seneca()

si.decorate('lorem', function (self) {
  console.log(this === self)
})

si.add('hello:world', function (args, reply) {
  const delegate = this.delegate()

  // logs true (as expected) in master (p4.0.0-t.1.p.1)
  // logs false (incorrect) in v3.30.0
  delegate.lorem(delegate)

  reply()
})

si.ready(() => {
  si.act('hello:world', () => {})
})