diff options
| author | XhmikosR <[email protected]> | 2019-11-21 02:47:15 +0200 |
|---|---|---|
| committer | Nick Merwin <[email protected]> | 2019-11-20 16:47:15 -0800 |
| commit | eba01a29c69f28ffd7f50556492a43b5ba2486d7 (patch) | |
| tree | dd0773f3cdc01f87c99be6baf61fa9eb0e3bd7b0 | |
| parent | cbc1bdf5ab1c48e5c6a59d229e4e601bd25f351d (diff) | |
| download | node-coveralls-eba01a29c69f28ffd7f50556492a43b5ba2486d7.tar.xz node-coveralls-eba01a29c69f28ffd7f50556492a43b5ba2486d7.zip | |
Fix tests on Windows. (#237)
| -rw-r--r-- | test/convertLcovToCoveralls.js | 20 | ||||
| -rw-r--r-- | test/detectLocalGit.js | 4 | ||||
| -rw-r--r-- | test/handleInput.js | 11 |
3 files changed, 18 insertions, 17 deletions
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js index eb67305..7ab6d18 100644 --- a/test/convertLcovToCoveralls.js +++ b/test/convertLcovToCoveralls.js @@ -9,9 +9,9 @@ logger = require('log-driver')({level : false}); describe("convertLcovToCoveralls", function(){ it ("should convert a simple lcov file", function(done){ delete process.env.TRAVIS; - var lcovpath = __dirname + "/../fixtures/onefile.lcov"; + var lcovpath = path.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(lcovpath, "utf8"); - var libpath = __dirname + "/../fixtures/lib"; + var libpath = path.join(__dirname, "/../fixtures/lib"); convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ should.not.exist(err); output.source_files[0].name.should.equal("index.js"); @@ -33,7 +33,7 @@ describe("convertLcovToCoveralls", function(){ process.env.COVERALLS_PARALLEL = "true"; getOptions(function(err, options){ - var lcovpath = __dirname + "/../fixtures/onefile.lcov"; + var lcovpath = path.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(lcovpath, "utf8"); var libpath = "fixtures/lib"; options.filepath = libpath; @@ -48,7 +48,7 @@ describe("convertLcovToCoveralls", function(){ }); it ("should work with a relative path as well", function(done){ delete process.env.TRAVIS; - var lcovpath = __dirname + "/../fixtures/onefile.lcov"; + var lcovpath = path.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(lcovpath, "utf8"); var libpath = "fixtures/lib"; convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ @@ -61,7 +61,7 @@ describe("convertLcovToCoveralls", function(){ it ("should convert absolute input paths to relative", function(done){ delete process.env.TRAVIS; - var lcovpath = __dirname + "/../fixtures/istanbul.lcov"; + var lcovpath = path.join(__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"); @@ -83,14 +83,14 @@ describe("convertLcovToCoveralls", function(){ fs.existsSync = originalExistsSync; should.not.exist(err); - output.source_files[0].name.should.equal(path.join("svgo", "config.js")); + output.source_files[0].name.should.equal(path.posix.join("svgo", "config.js")); done(); }); }); it ("should handle branch coverage data", function(done){ process.env.TRAVIS_JOB_ID = -1; - var lcovpath = __dirname + "/../fixtures/istanbul.lcov"; + var lcovpath = path.join(__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"); @@ -119,7 +119,7 @@ describe("convertLcovToCoveralls", function(){ it ("should ignore files that do not exists", function(done){ delete process.env.TRAVIS; - var lcovpath = __dirname + "/../fixtures/istanbul.lcov"; + var lcovpath = path.join(__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"); @@ -148,7 +148,7 @@ describe("convertLcovToCoveralls", function(){ it ("should parse file paths concatenated by typescript and ng 2", function(done) { process.env.TRAVIS_JOB_ID = -1; - var lcovpath = __dirname + "/../fixtures/istanbul.remap.lcov"; + var lcovpath = path.join(__dirname, "/../fixtures/istanbul.remap.lcov"); var input = fs.readFileSync(lcovpath, "utf8"); var libpath = "/Users/deepsweet/Dropbox/projects/svgo/lib"; var sourcepath = path.resolve(libpath, "svgo/config.js"); @@ -170,7 +170,7 @@ describe("convertLcovToCoveralls", function(){ fs.existsSync = originalExistsSync; should.not.exist(err); - output.source_files[0].name.should.equal(path.join("svgo", "config.js")); + output.source_files[0].name.should.equal(path.posix.join("svgo", "config.js")); done(); }); }); diff --git a/test/detectLocalGit.js b/test/detectLocalGit.js index 64da493..bc3158c 100644 --- a/test/detectLocalGit.js +++ b/test/detectLocalGit.js @@ -57,8 +57,8 @@ function _cleanTempGitDir() { function _deleteFolderRecursive(dir) { - if (!dir.match('node-coveralls/test')) { - throw new Error('Tried to clean a temp git directory that did not match path: node-coveralls/test'); + if (!dir.includes(path.normalize('node-coveralls/test'))) { + throw new Error('Tried to clean a temp git directory that did not match path: ' + path.normalize('node-coveralls/test')); } if(fs.existsSync(dir)) { diff --git a/test/handleInput.js b/test/handleInput.js index d6f8098..bca7b16 100644 --- a/test/handleInput.js +++ b/test/handleInput.js @@ -1,3 +1,4 @@ +var sysPath = require('path'); var should = require('should'); var sinon = require('sinon-restore'); var index = require('../index'); @@ -12,7 +13,7 @@ describe("handleInput", function(){ sinon.stub(index, 'getOptions', function(cb){ return cb("some error", {}); }); - var path = __dirname + "/../fixtures/onefile.lcov"; + var path = sysPath.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(path, "utf8"); index.handleInput(input, function(err){ err.should.equal("some error"); @@ -26,7 +27,7 @@ describe("handleInput", function(){ sinon.stub(index, 'convertLcovToCoveralls', function(input, options, cb){ cb("some error"); }); - var path = __dirname + "/../fixtures/onefile.lcov"; + var path = sysPath.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(path, "utf8"); index.handleInput(input, function(err){ err.should.equal("some error"); @@ -40,7 +41,7 @@ describe("handleInput", function(){ sinon.stub(index, 'sendToCoveralls', function(postData, cb){ cb("some error"); }); - var path = __dirname + "/../fixtures/onefile.lcov"; + var path = sysPath.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(path, "utf8"); index.handleInput(input, function(err){ err.should.equal("some error"); @@ -54,7 +55,7 @@ describe("handleInput", function(){ sinon.stub(index, 'sendToCoveralls', function(postData, cb){ cb(null, {statusCode : 500}, "body"); }); - var path = __dirname + "/../fixtures/onefile.lcov"; + var path = sysPath.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(path, "utf8"); index.handleInput(input, function(err){ err.should.equal("Bad response: 500 body"); @@ -68,7 +69,7 @@ describe("handleInput", function(){ sinon.stub(index, 'sendToCoveralls', function(postData, cb){ cb(null, {statusCode : 200}, "body"); }); - var path = __dirname + "/../fixtures/onefile.lcov"; + var path = sysPath.join(__dirname, "/../fixtures/onefile.lcov"); var input = fs.readFileSync(path, "utf8"); index.handleInput(input, function(err, body){ (err === null).should.equal(true); |
