jakejs/jake

Can A Rule Be An Async Function?

virtualpatterns opened this issue · 0 comments

I've tried the following as a test ...

Rule('b', 'source/index.js', function () {
  console.log(`Waiting on '${this.name}' ...`)
  return new Promise((resolve) => {
    setTimeout(resolve, 5000)
  })
})

Task('a', [ 'b' ], function () {
  console.log(`Waiting on '${this.name}' ...`)
  return new Promise((resolve) => {
    setTimeout(resolve, 5000)
  })
})

... but the Rule is never waited upon. The Rule should take at least 5s to run but it takes < 1ms ... it is never completed.

Sync Rule functions behave as expected but not async functions. Should they?