Hi.
I have some code that depends on node-etcd, which in turn depends on deasync.
The code runs fine, under node 6.5 and 6.2.
I've added a simple test for that code using jest, and when executed, jest fails with the following:
Could not locate the bindings file. Tried:
→ /home/reflog/dev/basicServer/node_modules/deasync/build/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/build/Debug/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/build/Release/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/out/Debug/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/Debug/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/out/Release/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/Release/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/build/default/deasync.node
→ /home/reflog/dev/basicServer/node_modules/deasync/compiled/6.5.0/linux/x64/deasync.node
at bindings (node_modules/bindings/bindings.js:88:9)
at node_modules/deasync/index.js:34:32
at Object.<anonymous> (node_modules/deasync/index.js:76:2)
at Object.<anonymous> (node_modules/node-etcd/lib/client.js:7:11)
at Object.<anonymous> (node_modules/node-etcd/lib/index.js:9:10)
at Object.<anonymous> (lib/server-base.js:16:12)
at Object.<anonymous> (lib/test/testRun.js:2:23)
at process._tickCallback (internal/process/next_tick.js:103:7)
Indeed, the files that are mentioned in the error are not present, but, to reiterate - when running the same test file without jest (just the actual test code) - it runs fine.
I guess something in the way jest initialises node environment confuses the bindings library.
If any additional details are need - I'm happy to provide.
Thanks in advance!
Thanks for reporting. This does seem like a bug!
Awesome! Do you want me to create a repo to for reproducing the problem, or it's clear for you?
A repo would be helpful, yes! Sorry for the bug.
On Wed, Sep 14, 2016 at 11:21 PM -0700, "Eli Yukelzon" <[email protected]notifications@github.com> wrote:
Awesome! Do you want me to create a repo to for reproducing the problem, or it's clear for you?
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHubhttps://github.com/facebook/jest/issues/1694#issuecomment-247245425, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAA0KJ7REXOF06_QVQSnaXmvBZBpc4Bnks5qqOPcgaJpZM4J8_RS.
Welp. It's always useful to create a reproducing repo. This way - you find out, that you are a dumb ass :) Apparently, I forgot that I had a preprocessor for Typescript, (ts-jest) and it was the one causing the problems.
Jest is not at fault here. Yey!
Closing the issue - no bug here.
Thanks!
I've opened the bug in ts-jest https://github.com/kulshekhar/ts-jest/issues/2
Just a note for posterity - this error was caused by the deasync dependency which needed to be rebuilt using node-gyp. It wasn't due to a bug in jest orts-jest
@cpojer maybe the bug label should be removed?
Edit: Ignore this comment for now.
@cpojer , with help of @kulshekhar we came to the conclusion that it is, in fact a problem with Jest.
Here's a repo with steps to reproduce:
https://github.com/kulshekhar/jest_bug_test
To check:
This repo doesn't use any preprocessors, it's just jest and javascript.
Thanks in advance!
@cpojer @reflog
This is not a Jest bug. In that particular repository (jest_bug_test), you are using moduleFileExtensions option and you don't have .node in there. If you take a look at moduleFileExtensions, you will see that .node is one of the defaults. So you must also have it there if you want to be able to work with Node addons.
If you use .js as the only module extension, some other packages that rely on requiring json files will also break.
Most helpful comment
@cpojer @reflog
This is not a Jest bug. In that particular repository (
jest_bug_test), you are usingmoduleFileExtensionsoption and you don't have.nodein there. If you take a look at moduleFileExtensions, you will see that.nodeis one of the defaults. So you must also have it there if you want to be able to work with Node addons.If you use
.jsas the only module extension, some other packages that rely on requiring json files will also break.