Skip to content

Commit

Permalink
Use the original process.argv
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jan 6, 2018
1 parent 79aaec0 commit 42959c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ matrix:
- yarn run link
- echo "This is the real `danger ci` run on this repo"
- DEBUG="*" danger ci --verbose
- DEBUG="*" danger pr https://github.com/danger/danger-js/pull/465 --verbose # To make sure it isn't broken again in a bad build
- echo "Validating that danger pr works as expected"
- DEBUG="*" danger pr https://github.com/danger/danger-js/pull/465 --verbose

# Create some fake projects at runtime
- node_js: '7'
Expand Down
4 changes: 3 additions & 1 deletion source/commands/danger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ program
console.log(" http://danger.systems/js/reference.html")
})

// Commander mutates process.argv
const originalProcessArgV = process.argv
program.parse(process.argv)

const showUpgradeNotice =
process.env.CI && ["init", "ci", "process", "pr", "--help"].some(cmd => process.argv.includes(cmd))
process.env.CI && ["init", "ci", "process", "pr", "--help"].some(cmd => originalProcessArgV.includes(cmd))

if (showUpgradeNotice) {
console.error("You may have updated from Danger 2.x -> 3.x without updating from `danger` to `danger ci`.")
Expand Down

0 comments on commit 42959c7

Please sign in to comment.