Open mkcedward opened 8 years ago
We are having exactly same issue in our development. When we are running unit tests with istanbul, all the tested units which runs mapReduce using Node.JS MongoDB driver fails with same exception message as described above.
We would be grateful for any hints on this issue.
I further search for root cause. Somebody mentioned that it is caused by istanbul implementations (https://github.com/Automattic/mongoose/issues/2293).
//Quoted Start// Yeah this is entirely due to how mapReduce works with istanbul - mongodb stringifies your functions to pass them to the mongodb server. Istanbul transforms your code in order to do coverage properly, which is bad because mongodb doesn't know what "__cov_9tvxKQzOKv6vn95EmDGJ3A" is. Just define your map/reduce functions as strings rather than as functions and it should work: //Quoted End//
I already got this mongo map reduce error in my mocha tests. Is there another solution than overriding mongos map/reduce functions?
I am trying to run mapReduce via Mongoose against my MongoDB and it is passed when only using mocha to run test case. However, it got error from MongoDB when using istanbul. It got the following exception. Any hints on this issue?
/* Exception Message */ [conn1] ReferenceError: cov_jaRS0vu3yfRncVPF44UeNw is not defined :_funcs1@:1:23 [conn1] mr failed, removing collection :: caused by :: 139 ReferenceError:cov_jaRS0vu3yfRncVPF44UeNw is not defined :_funcs1@:1:23