thingdom/node-neo4j

Callback function not working when running with mocha/chai

bobbwhy opened this issue · 2 comments

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));
                    }
                    }
                );

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

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.