feat: consider the workdir in pytest annotations

This commit is contained in:
Martin Fillafer 2023-03-14 11:30:29 +01:00
parent 7442569c25
commit 0d3dd791da
3 changed files with 40 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import * as path from 'path'
import {PytestJunitParser} from '../src/parsers/pytest-junit/pytest-junit-parser'
import {ParseOptions} from '../src/test-parser'
import {normalizeFilePath} from '../src/utils/path-utils'
import {getAnnotations} from '../src/report/get-annotations'
describe('pytest-junit tests', () => {
it('test with one successful test', async () => {
@ -29,7 +30,8 @@ describe('pytest-junit tests', () => {
const opts: ParseOptions = {
parseErrors: true,
trackedFiles: []
workDir: 'mnt/extra-addons',
trackedFiles: ['mnt/extra-addons/product_changes/tests/first_test.py']
}
const parser = new PytestJunitParser(opts)
@ -40,5 +42,9 @@ describe('pytest-junit tests', () => {
line: 6,
message: 'assert False'
})
const annotations = getAnnotations([result], 1)
expect(annotations.length).toBe(1)
expect(annotations[0].path).toBe('product_changes/tests/first_test.py')
})
})