mirror of
https://github.com/dorny/test-reporter.git
synced 2026-05-06 18:47:35 +02:00
Add sort-suites report coverage
This commit is contained in:
parent
0e1fe1690f
commit
a1f5af1564
1 changed files with 27 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import {getBadge, DEFAULT_OPTIONS, ReportOptions} from '../../src/report/get-report.js'
|
import {DEFAULT_OPTIONS, getBadge, getReport, ReportOptions} from '../../src/report/get-report.js'
|
||||||
|
import {TestCaseResult, TestGroupResult, TestRunResult, TestSuiteResult} from '../../src/test-results.js'
|
||||||
|
|
||||||
describe('getBadge', () => {
|
describe('getBadge', () => {
|
||||||
describe('URI encoding with special characters', () => {
|
describe('URI encoding with special characters', () => {
|
||||||
|
|
@ -131,3 +132,28 @@ describe('getBadge', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('getReport', () => {
|
||||||
|
it('sorts suites by descending time when configured', () => {
|
||||||
|
const results = [
|
||||||
|
new TestRunResult('report.xml', [
|
||||||
|
createSuite('unit', 10),
|
||||||
|
createSuite('integration', 30),
|
||||||
|
createSuite('smoke', 20)
|
||||||
|
])
|
||||||
|
]
|
||||||
|
|
||||||
|
const report = getReport(results, {
|
||||||
|
...DEFAULT_OPTIONS,
|
||||||
|
sortSuites: 'time-desc',
|
||||||
|
listTests: 'none'
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(report.indexOf('integration')).toBeLessThan(report.indexOf('smoke'))
|
||||||
|
expect(report.indexOf('smoke')).toBeLessThan(report.indexOf('unit'))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function createSuite(name: string, time: number): TestSuiteResult {
|
||||||
|
return new TestSuiteResult(name, [new TestGroupResult(name, [new TestCaseResult(`${name}-test`, 'success', time)])])
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue