Fix flutter-json doesn't provide error details

This commit is contained in:
Michal Dorner 2021-02-01 15:08:21 +01:00
parent 2365963b2e
commit 855ff9bfaf
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
13 changed files with 3196 additions and 51 deletions

View file

@ -27,4 +27,27 @@ describe('dart-json tests', () => {
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
it('report from rrousselGit/provider test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'flutter', 'provider-test-results.json')
const trackedFilesPath = path.join(__dirname, 'fixtures', 'external', 'flutter', 'files.txt')
const outputPath = path.join(__dirname, '__outputs__', 'provider-test-results.md')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
const trackedFiles = fs.readFileSync(trackedFilesPath, {encoding: 'utf8'}).split(/\n\r?/g)
const opts: ParseOptions = {
trackedFiles,
parseErrors: true,
workDir: '/__w/provider/provider/'
}
const parser = new DartJsonParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result).toMatchSnapshot()
const report = getReport([result])
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})