Open
Description
I had a fail based on two long strings which I fixed this way:
After putting a console.log
in the dangerfile. This ain't good.
Code looked like this:
import dtsGenerator from "./scripts/danger-dts"
const currentDTS = dtsGenerator()
const savedDTS = fs.readFileSync("source/danger.d.ts").toString()
if (currentDTS !== savedDTS) {
const message = "There are changes to the Danger DSL which are not reflected in the current danger.d.ts."
const idea = "Please run <code>yarn declarations</code> and update this PR."
fail(`${message}<br/><i>${idea}</i>`)
}
We already have jest-diff
inside the app, due to jest-config
, so what about instead we provide something like:
import dtsGenerator from "./scripts/danger-dts"
const currentDTS = dtsGenerator()
const savedDTS = fs.readFileSync("source/danger.d.ts").toString()
const message = "There are changes to the Danger DSL which are not reflected in the current danger.d.ts."
const idea = "Please run <code>yarn declarations</code> and update this PR."
const failureMessage =`${message}<br/><i>${idea}</i>`
danger.utils.checkEqual(fail, failureMessage, currentDTS, savedDTS)
Where we can present jest-matcher like messages inline. For example:
or
Activity