• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

strongloop / loopback-next / 3274
76%

Build:
DEFAULT BRANCH: master
Ran 12 Jan 2018 08:42AM UTC
Jobs 2
Files 147
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
3274

push

travis-ci

web-flow
feat(context): forbid bind().to() a Promise instance (#854)

Promises are a construct primarily intended for flow control:
In an algorithm with steps 1 and 2, we want to wait for the outcome
of step 1 before starting step 2.

Promises are NOT a tool for storing values that may become available
in the future, depending on the success or a failure of a background
async task.

Values stored in bindings are typically accessed only later,
in a different turn of the event loop or the Promise micro-queue.
As a result, when a promise is stored via `.to()` and is rejected
later, then more likely than not, there will be no error (catch)
handler registered yet, and Node.js will print
"Unhandled Rejection Warning".

BREAKING CHANGE: It is no longer possible to pass a promise instance
to `.to()` method of a Binding. Use `.toDynamicValue()` instead.
Consider deferring the async computation (that produced the promise
instance you are binding) into the dynamic value getter function,
i.e. start the async computation only from the getter function.

An example diff showing how to upgrade your existing code:

-    ctx.bind('bar').to(Promise.resolve('BAR'));
+    ctx.bind('bar').toDynamicValue(() => Promise.resolve('BAR'));

845 of 956 branches covered (88.39%)

Branch coverage included in aggregate %.

5998 of 6139 relevant lines covered (97.7%)

60.19 hits per line

Jobs
ID Job ID Ran Files Coverage
1 3274.1 12 Jan 2018 08:43AM UTC 0
96.43
Travis Job 3274.1
2 3274.2 12 Jan 2018 08:42AM UTC 0
96.32
Travis Job 3274.2
Source Files on build 3274
  • Tree
  • List 0
  • Changed 10
  • Source Changed 4
  • Coverage Changed 10
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Travis Build #3274
  • 85ffa8b3 on github
  • Prev Build on master (#3264)
  • Next Build on master (#3276)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc