aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArjan Singh <[email protected]>2016-04-06 21:36:30 -0700
committerArjan Singh <[email protected]>2016-09-14 15:26:48 -0700
commit993332233a2f02695a769e2c17c0d593a96b14c9 (patch)
tree47a930b30eba0ad5be78a610666f17ec0f866d2b /test
parent95c4dfdd305e27afa5ac2d1dc910b04a1524918b (diff)
downloadnode-coveralls-993332233a2f02695a769e2c17c0d593a96b14c9.tar.xz
node-coveralls-993332233a2f02695a769e2c17c0d593a96b14c9.zip
Ignore files that do not exist in convertLcovToCoveralls
Diffstat (limited to 'test')
-rw-r--r--test/convertLcovToCoveralls.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js
index 82ffdc8..bb4d8a6 100644
--- a/test/convertLcovToCoveralls.js
+++ b/test/convertLcovToCoveralls.js
@@ -75,12 +75,46 @@ describe("convertLcovToCoveralls", function(){
return originalReadFileSync.apply(fs, arguments);
};
+ var originalExistsSync = fs.existsSync;
+ fs.existsSync = function () { return true; };
+
convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){
fs.readFileSync = originalReadFileSync;
+ fs.existsSync = originalExistsSync;
should.not.exist(err);
output.source_files[0].name.should.equal(path.join("svgo", "config.js"));
done();
});
});
+
+ it ("should ignore files that do not exists", function(done){
+ process.env.TRAVIS_JOB_ID = -1;
+ var lcovpath = __dirname + "/../fixtures/istanbul.lcov";
+ var input = fs.readFileSync(lcovpath, "utf8");
+ var libpath = "/Users/deepsweet/Dropbox/projects/svgo/lib";
+ var sourcepath = path.resolve(libpath, "svgo/config.js");
+
+ var originalReadFileSync = fs.readFileSync;
+ fs.readFileSync = function(filepath) {
+ if (filepath === sourcepath) {
+ return '';
+ }
+
+ return originalReadFileSync.apply(fs, arguments);
+ };
+
+ var originalExistsSync = fs.existsSync;
+ fs.existsSync = function () { return false; };
+
+ convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){
+ fs.readFileSync = originalReadFileSync;
+ fs.existsSync = originalExistsSync;
+
+ should.not.exist(err);
+ output.source_files.should.be.empty;
+ done();
+ });
+ });
+
});