github-desktop/script/test-review

37 lines
771 B
Plaintext
Raw Normal View History

#!/usr/bin/env node
'use strict'
const fs = require('fs')
const path = require('path')
const { getUserDataPath } = require('./dist-info')
function reviewLogs() {
2017-06-19 10:30:49 +00:00
const directory = path.join(getUserDataPath(), 'logs')
if (!fs.existsSync(directory)) {
return
}
2017-06-19 10:30:49 +00:00
const files = fs.readdirSync(directory)
2017-07-13 15:11:04 +00:00
files.forEach(file => {
if (file.endsWith('.log')) {
console.log(`opening ${file}`)
const fullPath = path.join(directory, file)
const text = fs.readFileSync(fullPath, 'utf-8')
console.log(text)
}
})
}
if (process.platform === 'darwin') {
if (process.env.TRAVIS_TEST_RESULT === '1') {
reviewLogs()
}
}
if (process.platform === 'win32') {
if (process.env.APPVEYOR_TEST_RESULT !== '0') {
reviewLogs()
}
}