Fix JSON output
This commit is contained in:
parent
4c67cc50ed
commit
2b2071208f
6
test.js
6
test.js
@ -1,6 +1,6 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
var log = '{\n'
|
var log = '{\n'
|
||||||
var issuelog = '"message": "Title | Entry\\n----|----------------------\\n'
|
var issuelog = ' "message": "Title | Entry\\n----|----------------------\\n'
|
||||||
|
|
||||||
var file = fs.readFileSync(process.argv[2], 'utf8')
|
var file = fs.readFileSync(process.argv[2], 'utf8')
|
||||||
entryErrorCheck(file)
|
entryErrorCheck(file)
|
||||||
@ -31,12 +31,12 @@ function entryErrorCheck (md) {
|
|||||||
}
|
}
|
||||||
if (totalFail > 0) {
|
if (totalFail > 0) {
|
||||||
console.log(totalFail + ' Failed, ' + totalPass + ' Passed, of ' + total)
|
console.log(totalFail + ' Failed, ' + totalPass + ' Passed, of ' + total)
|
||||||
log += '"error": "true",\n"title": "Found ' + totalFail + ' syntax error(s).",\n'
|
log += ' "error": true,\n "title": "Found ' + totalFail + ' entries with syntax error(s).",\n'
|
||||||
fs.writeFileSync('syntaxcheck.json', log + issuelog + '"\n}')
|
fs.writeFileSync('syntaxcheck.json', log + issuelog + '"\n}')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
} else {
|
} else {
|
||||||
console.log(totalFail + ' Failed, ' + totalPass + ' Passed, of ' + total + '\n')
|
console.log(totalFail + ' Failed, ' + totalPass + ' Passed, of ' + total + '\n')
|
||||||
log += '"error": false,\n"title": "No errors found!"\n}'
|
log += ' "error": false\n}'
|
||||||
fs.writeFileSync('syntaxcheck.json', log)
|
fs.writeFileSync('syntaxcheck.json', log)
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user