Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move fixtures to test/fixtures. #286

Merged
merged 1 commit into from Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .jshintignore
@@ -0,0 +1 @@
test/fixtures/
19 changes: 10 additions & 9 deletions test/convertLcovToCoveralls.js
Expand Up @@ -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');
Expand All @@ -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';

Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions test/handleInput.js
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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);
Expand Down