Skip to content

Commit

Permalink
Merge pull request #91 from kwonoj/feat-debug
Browse files Browse the repository at this point in the history
feat(debug): debug module for dump status
  • Loading branch information
orta committed Jan 8, 2017
2 parents 92fbbf3 + 814d315 commit 5ddce59
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### master

// Add your own contribution below
* Allow debug dump output via `DEBUG=danger:*` environment variable - kwonoj
* Adds surf-build ci provider - kwonoj

* Forward environment variable to external module constructor - kwonoj

### 0.8.0
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"homepage": "https://github.com/danger/danger-js#readme",
"devDependencies": {
"@types/commander": "^2.3.31",
"@types/debug": "0.0.29",
"@types/es6-promise": "0.0.32",
"@types/jest": "^16.0.3",
"@types/node-fetch": "^1.6.6",
Expand All @@ -96,6 +97,7 @@
"dependencies": {
"babel-polyfill": "^6.20.0",
"commander": "^2.9.0",
"debug": "^2.6.0",
"jest-runtime": "^18.0.0",
"lodash.find": "^4.6.0",
"lodash.includes": "^4.3.0",
Expand Down
6 changes: 5 additions & 1 deletion source/commands/danger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
// import app from "./app"
import { version } from "../../package.json"
import * as program from "commander"
import * as debug from "debug"

// Provides the root node to the command-line architecture
const d = debug("danger:runner")

d(`argv: ${process.argv}`)

// Provides the root node to the command-line architecture
program
.version(version)
.command("run", "Runs danger on your local system", {isDefault: true})
Expand Down
6 changes: 5 additions & 1 deletion source/runner/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { DangerResults } from "../dsl/DangerResults"
import { template as githubResultsTemplate } from "./templates/github-issue-template"
import { createDangerfileRuntimeEnvironment, runDangerfileEnvironment } from "./DangerfileRunner"
import { DangerfileRuntimeEnv } from "./types"

import * as debug from "debug"
// This is still badly named, maybe it really should just be runner?

export class Executor {
private readonly d = debug("danger:executor")

constructor(public readonly ciSource: CISource, public readonly platform: Platform) {
}

Expand Down Expand Up @@ -70,6 +72,8 @@ export class Executor {
const failureCount = [...fails, ...warnings].length
const messageCount = [...messages, ...markdowns].length

this.d(results)

if (failureCount + messageCount === 0) {
console.log("No messages are collected.")
await this.platform.deleteMainComment()
Expand Down

0 comments on commit 5ddce59

Please sign in to comment.