gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

problem with mongodb #672

Closed TrejGun closed 7 years ago

TrejGun commented 8 years ago

I have a problem with code which is passed directly to mongo how ever I believe this can be a case with phantomjs and other libs too

here is an doc for mapReduce https://docs.mongodb.com/manual/core/map-reduce/

so the code in the project looks like

Model.mapReduce({
    _id: myId,
    map: function(){
        emit(model.prop, model.value);
    },
    reduce: function(key, values){
        return Array.sum(values);
    }
})

and causing an error

MongoError: ReferenceError: __cov_ddStlu$azUVg91hD_AsL3iLcer8 is not defined :
    map@:1:26
at Function.MongoError.create (node_modules/mongodb-core/lib/error.js:31:11)
at commandCallback (node_modules/mongodb-core/lib/topologies/server.js:1187:66)
at Callbacks.emit (node_modules/mongodb-core/lib/topologies/server.js:119:3)
at .messageHandler (node_modules/mongodb-core/lib/topologies/server.js:358:23)
at Socket.<anonymous> (node_modules/mongodb-core/lib/connection/connection.js:292:22)
at readableAddChunk (_stream_readable.js:177:18)
at Socket.Readable.push (_stream_readable.js:135:10)
at TCP.onread (net.js:542:20)
From previous event:
    at Function.mapReduce (node_modules/mongoose/lib/model.js:2132:10)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
From previous event:
    at Model.mapReduce (abstract.js:19:3)
at TransactionController.AbstractController.(anonymous function) [as mapReduce] (source/controllers/abstract/abstract.js:3:537)
at bookingController.distinct.then.transactionIds (source/controllers/operator/event.js:4:4741)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)

not sure what is the best way to fix this may be its possible to add some tags to exclude such code

TrejGun commented 7 years ago

as project is dead i'm closing this

davglass commented 7 years ago

This code base has been replaced, the latest source is hosted here: https://github.com/istanbuljs