-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promisify breaks resolve #151
Comments
What promisify implementation are you using? Since https://npmjs.com/util.promisify is built into node, that’s really the only implementation that matters. If resolve can’t promisify by default, we could maybe add a custom promisify symbol. Does it work with the canonical implementation? |
I've been using Bluebird to promisify, but even an initial check here.
Running node 9.5 |
|
Right above it I'm showing that the same path resolves with native resolve.
…On Feb 22, 2018 8:42 PM, "Jordan Harband" ***@***.***> wrote:
Unhandled promise rejection (rejection id: 1): Error: Cannot find module
'./Desktop/jest-example/index.js' from 'internal' - it seems like it's
properly rejecting. Try adding .catch(e => console.error(e))?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#151 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASHXnSxljP8-9qXB79SUBqt8WVYjfEnks5tXhdvgaJpZM4SP8to>
.
|
What happens with a non-promisified version of this module, however? |
@ljharb It works perfectly fine Let me explain this example: ➜ ~ trymodule util.promisify resolve
Gonna start a REPL with packages installed and loaded for you
'util.promisify' was already installed since before!
'resolve' was already installed since before!
Package 'util.promisify' was loaded and assigned to 'util_promisify' in the current scope
Package 'resolve' was loaded and assigned to 'resolve' in the current scope
REPL started... Regular
The
Node 9's native
The
|
Any idea what's going on here @ljharb? |
@reggi what happens if you call the promisified |
After looking into this a bit more, the issue is that the assumption that "promisify will work on everything" is flawed; it won't. Using In other words, I think the proper solution is to wrap |
I have an example of tests passing (can't publish at the moment) with
require.resolve
and withresolve
as a callback, but when I wrap resolve inconst resolveAsync = Promise.promisify(resolve)
for some reason the tests that worked are failing. I've also implemented my own wrapped promise and some of tests pass, and others fail, specifically cases where there's apackage.json
resolve.Any ideas why this package is un-promisify-able, and potential ways around it?
The text was updated successfully, but these errors were encountered: