From a0c69414b7dbeef7aaefdb00ad78dff2a724b192 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 24 Apr 2020 00:46:49 +0300 Subject: [PATCH] Move fixtures to test/fixtures. (#286) --- .jshintignore | 1 + test/convertLcovToCoveralls.js | 19 ++++++++++--------- {fixtures => test/fixtures}/istanbul.lcov | 0 .../fixtures}/istanbul.remap.lcov | 0 {fixtures => test/fixtures}/lib/index.js | 0 {fixtures => test/fixtures}/onefile.lcov | 0 test/handleInput.js | 10 +++++----- 7 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 .jshintignore rename {fixtures => test/fixtures}/istanbul.lcov (100%) rename {fixtures => test/fixtures}/istanbul.remap.lcov (100%) rename {fixtures => test/fixtures}/lib/index.js (100%) rename {fixtures => test/fixtures}/onefile.lcov (100%) diff --git a/.jshintignore b/.jshintignore new file mode 100644 index 00000000..8be5c353 --- /dev/null +++ b/.jshintignore @@ -0,0 +1 @@ +test/fixtures/ diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js index 92ee40d3..eca48a96 100644 --- a/test/convertLcovToCoveralls.js +++ b/test/convertLcovToCoveralls.js @@ -11,9 +11,9 @@ logDriver({ level: false }); describe('convertLcovToCoveralls', () => { it('should convert a simple lcov file', done => { delete process.env.TRAVIS; - const lcovpath = path.join(__dirname, '/../fixtures/onefile.lcov'); + const lcovpath = path.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); - const libpath = path.join(__dirname, '/../fixtures/lib'); + const libpath = path.join(__dirname, './fixtures/lib'); convertLcovToCoveralls(input, { filepath: libpath }, (err, output) => { should.not.exist(err); output.source_files[0].name.should.equal('index.js'); @@ -37,7 +37,7 @@ describe('convertLcovToCoveralls', () => { process.env.COVERALLS_FLAG_NAME = 'FLAG_NAME'; getOptions((err, options) => { - const lcovpath = path.join(__dirname, '/../fixtures/onefile.lcov'); + const lcovpath = path.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); const libpath = 'fixtures/lib'; @@ -56,11 +56,12 @@ describe('convertLcovToCoveralls', () => { }); }); }); + it('should work with a relative path as well', done => { delete process.env.TRAVIS; - const lcovpath = path.join(__dirname, '/../fixtures/onefile.lcov'); + const lcovpath = path.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); - const libpath = 'fixtures/lib'; + const libpath = 'test/fixtures/lib'; convertLcovToCoveralls(input, { filepath: libpath }, (err, output) => { should.not.exist(err); output.source_files[0].name.should.equal('index.js'); @@ -71,7 +72,7 @@ describe('convertLcovToCoveralls', () => { it('should convert absolute input paths to relative', done => { delete process.env.TRAVIS; - const lcovpath = path.join(__dirname, '/../fixtures/istanbul.lcov'); + const lcovpath = path.join(__dirname, './fixtures/istanbul.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); const libpath = '/Users/deepsweet/Dropbox/projects/svgo/lib'; const sourcepath = path.resolve(libpath, 'svgo/config.js'); @@ -100,7 +101,7 @@ describe('convertLcovToCoveralls', () => { it('should handle branch coverage data', done => { process.env.TRAVIS_JOB_ID = -1; - const lcovpath = path.join(__dirname, '/../fixtures/istanbul.lcov'); + const lcovpath = path.join(__dirname, './fixtures/istanbul.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); const libpath = '/Users/deepsweet/Dropbox/projects/svgo/lib'; const sourcepath = path.resolve(libpath, 'svgo/config.js'); @@ -129,7 +130,7 @@ describe('convertLcovToCoveralls', () => { it('should ignore files that do not exists', done => { delete process.env.TRAVIS; - const lcovpath = path.join(__dirname, '/../fixtures/istanbul.lcov'); + const lcovpath = path.join(__dirname, './fixtures/istanbul.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); const libpath = '/Users/deepsweet/Dropbox/projects/svgo/lib'; const sourcepath = path.resolve(libpath, 'svgo/config.js'); @@ -158,7 +159,7 @@ describe('convertLcovToCoveralls', () => { it('should parse file paths concatenated by typescript and ng 2', done => { process.env.TRAVIS_JOB_ID = -1; - const lcovpath = path.join(__dirname, '/../fixtures/istanbul.remap.lcov'); + const lcovpath = path.join(__dirname, './fixtures/istanbul.remap.lcov'); const input = fs.readFileSync(lcovpath, 'utf8'); const libpath = '/Users/deepsweet/Dropbox/projects/svgo/lib'; const sourcepath = path.resolve(libpath, 'svgo/config.js'); diff --git a/fixtures/istanbul.lcov b/test/fixtures/istanbul.lcov similarity index 100% rename from fixtures/istanbul.lcov rename to test/fixtures/istanbul.lcov diff --git a/fixtures/istanbul.remap.lcov b/test/fixtures/istanbul.remap.lcov similarity index 100% rename from fixtures/istanbul.remap.lcov rename to test/fixtures/istanbul.remap.lcov diff --git a/fixtures/lib/index.js b/test/fixtures/lib/index.js similarity index 100% rename from fixtures/lib/index.js rename to test/fixtures/lib/index.js diff --git a/fixtures/onefile.lcov b/test/fixtures/onefile.lcov similarity index 100% rename from fixtures/onefile.lcov rename to test/fixtures/onefile.lcov diff --git a/test/handleInput.js b/test/handleInput.js index 46cbe504..c46aa172 100644 --- a/test/handleInput.js +++ b/test/handleInput.js @@ -15,7 +15,7 @@ describe('handleInput', () => { }); it('returns an error when there\'s an error getting options', done => { sinon.stub(index, 'getOptions', cb => cb('some error', {})); - const path = sysPath.join(__dirname, '/../fixtures/onefile.lcov'); + const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, err => { err.should.equal('some error'); @@ -27,7 +27,7 @@ describe('handleInput', () => { sinon.stub(index, 'convertLcovToCoveralls', (input, options, cb) => { cb('some error'); }); - const path = sysPath.join(__dirname, '/../fixtures/onefile.lcov'); + const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, err => { err.should.equal('some error'); @@ -39,7 +39,7 @@ describe('handleInput', () => { sinon.stub(index, 'sendToCoveralls', (postData, cb) => { cb('some error'); }); - const path = sysPath.join(__dirname, '/../fixtures/onefile.lcov'); + const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, err => { err.should.equal('some error'); @@ -51,7 +51,7 @@ describe('handleInput', () => { sinon.stub(index, 'sendToCoveralls', (postData, cb) => { cb(null, { statusCode: 500 }, 'body'); }); - const path = sysPath.join(__dirname, '/../fixtures/onefile.lcov'); + const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, err => { err.should.equal('Bad response: 500 body'); @@ -63,7 +63,7 @@ describe('handleInput', () => { sinon.stub(index, 'sendToCoveralls', (postData, cb) => { cb(null, { statusCode: 200 }, 'body'); }); - const path = sysPath.join(__dirname, '/../fixtures/onefile.lcov'); + const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, (err, body) => { should.not.exist(err);