Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Nov 12, 2018
1 parent e1b7d94 commit c3d6dff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions source/commands/utils/runDangerSubprocess.ts
Expand Up @@ -52,11 +52,12 @@ export const runDangerSubprocess = (
const maybeJSON = getJSONFromSTDOUT(stdout)
const maybeJSONURL = getJSONURLFromSTDOUT(stdout)

// Remove message sent abck to danger-js
const withoutURLs = data
// Remove message sent back to danger-js
const withoutURLs: string = data
.toString()
.replace(maybeJSON, "")
.replace(maybeJSONURL)
.replace(maybeJSONURL, "")

console.log(withoutURLs)

// Pass it back to the user
Expand Down
9 changes: 7 additions & 2 deletions source/runner/jsonToContext.ts
Expand Up @@ -3,6 +3,7 @@ import { jsonToDSL } from "./jsonToDSL"
import { contextForDanger, DangerContext } from "./Dangerfile"
import { DangerDSLJSON } from "./dangerDSLJSON"
import { CISource } from "../ci_source/ci_source"
import { CommanderStatic } from "commander"

/**
* Reads in the JSON string converts to a dsl object and gets the change context
Expand All @@ -11,8 +12,12 @@ import { CISource } from "../ci_source/ci_source"
* @param program {any} commander
* @returns {Promise<DangerContext>} context for danger
*/
export async function jsonToContext(JSONString: string, program: any, source: CISource): Promise<DangerContext> {
const dslJSON = { danger: new DangerDSLJSON(JSONString, program as CliArgs) }
export async function jsonToContext(
JSONString: string,
program: CommanderStatic,
source: CISource
): Promise<DangerContext> {
const dslJSON = { danger: new DangerDSLJSON(JSONString, (program as any) as CliArgs) }
const dsl = await jsonToDSL(dslJSON.danger, source)
return contextForDanger(dsl)
}

0 comments on commit c3d6dff

Please sign in to comment.