Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #53 from codecov/feature/flags
Browse files Browse the repository at this point in the history
Add support for flags
  • Loading branch information
eddiemoore committed Mar 18, 2017
2 parents 3c8fb1b + d30985e commit f62aab6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/codecov
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var args = argv.option([
{name: 'build', short: 'B', type: 'string', description: "Specify a custom build number to distinguish ci jobs, provided automatically for supported ci companies"},
{name: 'slug', short: 'r', type: 'string', description: "Specify repository slug for Enterprise ex. owner/repo"},
{name: 'url', short: 'u', type: 'string', description: "Your Codecov endpoint"},
{name: 'flags', short: 'F', type: 'string', description: "Codecov Flags"},
{name: 'dump', type: 'boolean', description: "Dump collected data and do not send to Codecov"}
]).run();

Expand Down
5 changes: 5 additions & 0 deletions lib/codecov.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ var upload = function(args, on_success, on_failure){
query.slug = args.options.slug;
}

var flags = (args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS);
if (flags) {
query.flags = flags;
}

var token = (args.options.token || process.env.codecov_token || process.env.CODECOV_TOKEN);
if (token){
query.token = token;
Expand Down
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ describe("Codecov", function(){
expect(res.query.slug).to.eql('value');
});

it("can get flags from cli args", function(){
var res = codecov.upload({options: {dump: true, flags: 'value'}});
expect(res.query.flags).to.eql('value');
});

it("can include env in cli", function(){
process.env.HELLO = 'world';
var res = codecov.upload({options: {dump: true, env: 'HELLO,VAR1'}});
Expand Down

0 comments on commit f62aab6

Please sign in to comment.