Open majidhassan opened 8 years ago
I also tried running Parse as an express app, then passing it to supertest. But none of that worked. Using this approach I even got the 0% issue even when passing includeUntested: true
.
This is my test case, including Parse Server instantiation.
var app_id = "<actual app id>";
var headers = {"X-Parse-Application-Id": app_id, "Content-Type": "application/json"};
// SETUP PARSE
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var api = new ParseServer({
databaseURI: "<actual mongo URI>",
cloud: "<actual cloud path>",
appId: app_id,
masterKey: "<actual master key>",
serverURL: "http://localhost:1337/parse"
});
var app = express();
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);
var httpServer = require('http').createServer(app);
httpServer.listen(1337, function() {
console.log('parse-server-example running on port ' + 1337 + '.');
});
// END OF PARSE SETUP
var request = require('supertest');
// var test_api = request.agent("http://localhost:1337/parse/");
var test_api = request.agent(app);
// UNIT test begin
describe("SAMPLE unit test", function() {
it("should get constants", function(done) {
test_api
.post('functions/getConstants')
.set(headers)
.expect(200)
.end(function(err, res) {
done();
});
});
});
Hello,
I'm trying to use gulp-istanbul with gulp-mocha to get coverage on my parse-server API, but I can't seem to get any coverage on my cloud files.
This is my gulpfile.js:
And the following is a sample from my mocha tests:
Any ideas, what I might be doing wrong?