Fix tests + jest-junit uses action 'name' input for title

This commit is contained in:
Michal Dorner 2021-01-10 18:01:52 +01:00
parent 4e2ae7493f
commit e7636701ef
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
3 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@ import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import {parseDartJson} from '../src/parsers/dart-json/dart-json-parser' import {parseDartJson} from '../src/parsers/dart-json/dart-json-parser'
import {ParseOptions} from '../src/parsers/test-parser' import {ParseOptions} from '../src/parsers/parser-types'
const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'dart-json.json'), {encoding: 'utf8'}) const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'dart-json.json'), {encoding: 'utf8'})
const outputPath = __dirname + '/__outputs__/dart-json.md' const outputPath = __dirname + '/__outputs__/dart-json.md'

View file

@ -2,7 +2,7 @@ import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import {parseJestJunit} from '../src/parsers/jest-junit/jest-junit-parser' import {parseJestJunit} from '../src/parsers/jest-junit/jest-junit-parser'
import {ParseOptions} from '../src/parsers/test-parser' import {ParseOptions} from '../src/parsers/parser-types'
const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'jest-junit.xml'), {encoding: 'utf8'}) const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'jest-junit.xml'), {encoding: 'utf8'})
const outputPath = __dirname + '/__outputs__/jest-junit.md' const outputPath = __dirname + '/__outputs__/jest-junit.md'
@ -10,7 +10,7 @@ const outputPath = __dirname + '/__outputs__/jest-junit.md'
describe('jest-junit tests', () => { describe('jest-junit tests', () => {
it('matches report snapshot', async () => { it('matches report snapshot', async () => {
const opts: ParseOptions = { const opts: ParseOptions = {
name: 'unused', name: 'jest tests',
annotations: true, annotations: true,
trackedFiles: ['__tests__/main.test.js', '__tests__/second.test.js', 'lib/main.js'], trackedFiles: ['__tests__/main.test.js', '__tests__/second.test.js', 'lib/main.js'],
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/jest/' workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/jest/'

View file

@ -26,7 +26,7 @@ export async function parseJestJunit(content: string, options: ParseOptions): Pr
return { return {
success, success,
output: { output: {
title: `${junit.testsuites.$.name.trim()} ${icon}`, title: `${options.name.trim()} ${icon}`,
summary: getSummary(junit), summary: getSummary(junit),
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
} }