thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
925 stars 135 forks source link

Callback function not working when running with mocha/chai #208

Open bobbwhy opened 8 years ago

bobbwhy commented 8 years ago

I tried a sample code piece, executing in the same file as my mocha/chai calls, but placed before the describe/it sequences in mocha. That returned a console.log that places as the first line in the callback. But the pieces that were nested within mocha commands would not show the console.log statements from the callback.

I am using node 6.2 and Neo4j 3.0.4.

sample code is below... mostly lifted straight off example page.

thanks.


db.cypher({
                    query: 'MATCH (u:User {email: {email}}) RETURN u',
                    params: {
                    email: 'alice@example.com', 
                    },
                    }, 
                    (err, results)=> {
                        console.log(' the only')
                        log.info(' my thought')
                    if (err) throw err;
                    var result = results[0];
                    if (!result) {
                        console.log('No user found.');
                    } else {
                        var user = result['u'];
                        console.log(JSON.stringify(user, null, 4));
                    }
                    }
                );
aseemk commented 8 years ago

Hmm, that's surprising. Would you be open to pasting your whole Mocha test file?

bobbwhy commented 8 years ago

thanks so much for the quick reply. I have gone through multiple iterations with that file and I think I was simply not handling the async work correctly.

I will make another run at this on my own later tonight or tomorrow am and let you know if I still have the issue.

thanks for putting together this library.