2020-12-16 18:31:29 +03:00
|
|
|
const {message} = require("danger")
|
|
|
|
const {readFileSync, existsSync} = require("fs")
|
2020-12-16 19:14:46 +03:00
|
|
|
const parseDiff = require("parse-diff")
|
2020-12-16 18:31:29 +03:00
|
|
|
|
2020-12-16 18:47:38 +03:00
|
|
|
const diffPath = "./TypeScript/baseline-changes.diff"
|
2020-12-16 18:31:29 +03:00
|
|
|
if (existsSync(diffPath)) {
|
|
|
|
const diffContents = readFileSync(diffPath, "utf8")
|
2020-12-16 19:14:46 +03:00
|
|
|
const diffedFiles = parseDiff(diffContents)
|
|
|
|
|
|
|
|
const uninterestingFiles = [".generated.d.ts", "globalThisBlockscopedProperties.types", "mappedTypeRecursiveInference.types"]
|
|
|
|
const withoutKnownNormalFails = diffedFiles.filter(diff => {
|
2020-12-16 19:32:36 +03:00
|
|
|
return uninterestingFiles.filter(suffix => diff.to && diff.to.endsWith(suffix)).length > 0
|
2020-12-16 19:14:46 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
const md = ["## Changed baselines from the TypeScript test suite"]
|
|
|
|
|
|
|
|
withoutKnownNormalFails.forEach(diff => {
|
|
|
|
md.push(`#### ${diff.to || diff.from}}`)
|
|
|
|
|
|
|
|
md.push("```diff")
|
|
|
|
diff.chunks.forEach(chunk => {
|
|
|
|
md.push(chunk.content)
|
|
|
|
})
|
|
|
|
md.push("```")
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
message(md.join("\n"))
|
2020-12-16 18:31:29 +03:00
|
|
|
}
|