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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: codecov/codecov-node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.4
Choose a base ref
...
head repository: codecov/codecov-node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.1.0
Choose a head ref
  • 7 commits
  • 13 files changed
  • 5 contributors

Commits on Jul 9, 2018

  1. Update README.md

    eddiemoore authored Jul 9, 2018
    Copy the full SHA
    b0b580b View commit details
  2. Change from istanbul to nyc (#103)

    * Change from istanbul to nyc
    
    * Latest version of nyc
    eddiemoore authored Jul 9, 2018
    Copy the full SHA
    94cd1c6 View commit details
  3. Copy the full SHA
    625807c View commit details

Commits on Jul 21, 2018

  1. Add ESLint (#93)

    TheDancingCode authored and eddiemoore committed Jul 21, 2018
    Copy the full SHA
    77d7a5e View commit details

Commits on Aug 21, 2018

  1. Allow custom yaml file. (#107)

    * Add tests for custom `yaml`
    
    * Allow custom `yaml` file
    
    * Cleans missing variable
    
    * Add `yml` as cli argument.
    
    * rename `yml` cli argument to `y`
    This to keep it consistent.
    
    * Updates `bin` to receive `y` argument
    
    * Rename `y` cli back to `yml`.
    Added short name as `y`
    victorhqc authored and eddiemoore committed Aug 21, 2018
    Copy the full SHA
    1fff4dc View commit details

Commits on Sep 4, 2018

  1. fix: support .codecov.yml/codecov.yml files for token (#108)

    * fix: support `.codecov.yml`/`codecov.yml` files for token
    
    * fix: added more test coverage for gitlab
    
    * fix: cleanup env vars to avoid leaking into other tests
    
    * fix: updated test to use process.cwd()
    
    * package bumps
    dale tan authored and eddiemoore committed Sep 4, 2018
    Copy the full SHA
    7c1f16e View commit details
  2. v3.1.0

    Ed Moore committed Sep 4, 2018
    Copy the full SHA
    0ce3c76 View commit details
Showing with 3,309 additions and 372 deletions.
  1. +14 −0 .eslintrc.json
  2. +1 −0 .gitignore
  3. +1 −1 .travis.yml
  4. +0 −23 Makefile
  5. +1 −0 README.md
  6. +1 −1 appveyor.yml
  7. +2 −1 bin/codecov
  8. +1 −7 circle.yml
  9. +28 −10 lib/codecov.js
  10. +3,122 −324 package-lock.json
  11. +8 −4 package.json
  12. +106 −1 test/index.js
  13. +24 −0 test/services/gitlab.js
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"node": true,
"mocha": true
},
"globals": {
"expect": true
},
"extends": ["eslint:recommended", "prettier"],
"rules": {
"no-console": "off",
"no-empty": ["error", { "allowEmptyCatch": true }]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ node_js:
- "4"

after_success:
- ./bin/codecov -e TRAVIS_NODE_VERSION -f coverage/coverage.json
- ./bin/codecov -e TRAVIS_NODE_VERSION -f .nyc_output/*.json
23 changes: 0 additions & 23 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -95,3 +95,4 @@ nyc report --reporter=text-lcov > coverage.lcov
- v3.0.1 Security fixes
- v3.0.2 Security fixes
- v3.0.3 Support non-git/hg root dirs
- v3.0.4 Security fixes
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ test_script:
- npm run test

after_test:
- node .\bin\codecov -f coverage\coverage.json
- node .\bin\codecov -f .nyc_output\*.json

build: off

3 changes: 2 additions & 1 deletion bin/codecov
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ var args = argv.option([
{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"}
{name: 'dump', type: 'boolean', description: "Dump collected data and do not send to Codecov"},
{name: 'yml', short: 'y', type: 'string', description: "Configuration file Used to specify the location of the .codecov.yml config file. Defaults to codecov.yml and .codecov.yml"}
]).run();

codecov.upload(args);
8 changes: 1 addition & 7 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,4 @@ machine:

test:
post:
- ./bin/codecov -f coverage/coverage.json

deployment:
suite:
branch: /.*/
commands:
- make testsuite
- ./bin/codecov -f .nyc_output/*.json
38 changes: 28 additions & 10 deletions lib/codecov.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ var fs = require('fs')
var path = require('path')
var request = require('request')
var urlgrey = require('urlgrey')
var jsYaml = require('js-yaml')
var walk = require('ignore-walk')
var execSync = require('child_process').execSync

@@ -156,7 +157,7 @@ var sendToCodecovV2 = function(
Accept: 'text/plain',
},
},
function(err, response, result) {
function(err, response) {
if (err || response.statusCode !== 200) {
console.log(' ' + (err || response.body))
return response
@@ -210,7 +211,7 @@ var sendToCodecovV3 = function(
'x-amz-acl': 'public-read',
},
},
function(err, response, result) {
function(err) {
if (err) {
sendToCodecovV2(
codecov_endpoint,
@@ -240,6 +241,11 @@ var upload = function(args, on_success, on_failure) {
'https://codecov.io'
var query = {}
var debug = []
var yamlFile =
args.options.yml ||
process.env.codecov_yml ||
process.env.CODECOV_YML ||
'codecov.yml'

console.log(
'' +
@@ -253,20 +259,22 @@ var upload = function(args, on_success, on_failure) {
version
)

query.yaml = ['codecov.yml', '.codecov.yml'].reduce(function(result, file) {
return (
result ||
(fs.existsSync(path.resolve(process.cwd(), file)) ? file : undefined)
)
}, undefined)

if ((args.options.disable || '').split(',').indexOf('detect') === -1) {
console.log('==> Detecting CI Provider')
query = detectProvider()
} else {
debug.push('disabled detect')
}

query.yaml = [yamlFile, '.codecov.yml'].reduce(function(result, file) {
return (
result ||
(fs.existsSync(path.resolve(process.cwd(), file))
? path.resolve(process.cwd(), file)
: undefined)
)
}, undefined)

if (args.options.build) {
query.build = args.options.build
}
@@ -289,8 +297,18 @@ var upload = function(args, on_success, on_failure) {
query.flags = flags
}

var yamlToken
try {
var loadedYamlFile = jsYaml.safeLoad(fs.readFileSync(query.yaml, 'utf8'))
yamlToken = loadedYamlFile && loadedYamlFile.codecov && loadedYamlFile.codecov.token
} catch (e) {
// silently fail
}
var token =
args.options.token || process.env.codecov_token || process.env.CODECOV_TOKEN
args.options.token ||
yamlToken ||
process.env.codecov_token ||
process.env.CODECOV_TOKEN
if (token) {
query.token = token
}
Loading