Skip to content

Commit b76c18c

Browse files
feat: upgrade ctrf (#3)
1 parent d0cd721 commit b76c18c

File tree

4 files changed

+34
-84
lines changed

4 files changed

+34
-84
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Sorts tests by their failure rate in descending order, showing the most unreliab
7171
```handlebars
7272
Most Unreliable Tests:
7373
{{#each (sortTestsByFailRate tests)}}
74-
{{this.name}} - Fail Rate: {{this.extra.failRate}}%
74+
{{this.name}} - Fail Rate: {{this.insights.failRate.current}}%
7575
{{/each}}
7676
```
7777

@@ -92,7 +92,7 @@ Sorts tests by their flaky rate in descending order, showing the most flaky test
9292
```handlebars
9393
Most Flaky Tests:
9494
{{#each (sortTestsByFlakyRate tests)}}
95-
{{this.name}} - Flaky Rate: {{this.extra.flakyRate}}%
95+
{{this.name}} - Flaky Rate: {{this.insights.flakyRate.current}}%
9696
{{/each}}
9797
```
9898

@@ -174,8 +174,8 @@ Counts the total number of flaky tests in the test results.
174174
**Example:**
175175

176176
```handlebars
177-
Flaky tests detected: {{countFlaky tests}}
178-
{{#if (countFlaky tests)}}⚠️{{/if}}
177+
Flaky tests detected: {{countFlakyTests tests}}
178+
{{#if (countFlakyTests tests)}}⚠️{{/if}}
179179
```
180180

181181
---

__tests__/helpers/ctrf.test.ts

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,20 @@ describe("CTRF Helpers", () => {
2525
insights: {
2626
flakyRate: {
2727
current: 0.0,
28-
previous: 0.0,
28+
baseline: 0.0,
2929
change: 0.0,
3030
},
3131
failRate: {
3232
current: 0.1,
33-
previous: 0.1,
34-
change: 0.0,
35-
},
36-
skippedRate: {
37-
current: 0.0,
38-
previous: 0.0,
33+
baseline: 0.1,
3934
change: 0.0,
4035
},
4136
averageTestDuration: {
4237
current: 1000,
43-
previous: 1000,
38+
baseline : 1000,
4439
change: 0,
4540
},
46-
p95Duration: {
47-
current: 1200,
48-
previous: 1200,
49-
change: 0,
50-
},
51-
appearsInRuns: 10,
41+
executedInRuns: 10,
5242
},
5343
},
5444
{
@@ -60,30 +50,20 @@ describe("CTRF Helpers", () => {
6050
insights: {
6151
flakyRate: {
6252
current: 0.8,
63-
previous: 0.7,
53+
baseline: 0.7,
6454
change: 0.1,
6555
},
6656
failRate: {
6757
current: 0.9,
68-
previous: 0.8,
58+
baseline: 0.8,
6959
change: 0.1,
7060
},
71-
skippedRate: {
72-
current: 0.0,
73-
previous: 0.0,
74-
change: 0.0,
75-
},
7661
averageTestDuration: {
7762
current: 2000,
78-
previous: 1800,
79-
change: 200,
80-
},
81-
p95Duration: {
82-
current: 2500,
83-
previous: 2300,
63+
baseline: 1800,
8464
change: 200,
8565
},
86-
appearsInRuns: 10,
66+
executedInRuns: 10,
8767
},
8868
},
8969
{
@@ -94,30 +74,20 @@ describe("CTRF Helpers", () => {
9474
insights: {
9575
flakyRate: {
9676
current: 0.0,
97-
previous: 0.0,
77+
baseline: 0.0,
9878
change: 0.0,
9979
},
10080
failRate: {
10181
current: 0.0,
102-
previous: 0.0,
103-
change: 0.0,
104-
},
105-
skippedRate: {
106-
current: 1.0,
107-
previous: 1.0,
82+
baseline: 0.0,
10883
change: 0.0,
10984
},
11085
averageTestDuration: {
11186
current: 0,
112-
previous: 0,
87+
baseline: 0,
11388
change: 0,
11489
},
115-
p95Duration: {
116-
current: 0,
117-
previous: 0,
118-
change: 0,
119-
},
120-
appearsInRuns: 5,
90+
executedInRuns: 5,
12191
},
12292
},
12393
{
@@ -135,30 +105,20 @@ describe("CTRF Helpers", () => {
135105
insights: {
136106
flakyRate: {
137107
current: 0.6,
138-
previous: 0.5,
108+
baseline: 0.5,
139109
change: 0.1,
140110
},
141111
failRate: {
142112
current: 0.7,
143-
previous: 0.6,
113+
baseline: 0.6,
144114
change: 0.1,
145115
},
146-
skippedRate: {
147-
current: 0.0,
148-
previous: 0.0,
149-
change: 0.0,
150-
},
151116
averageTestDuration: {
152117
current: 1500,
153-
previous: 1400,
154-
change: 100,
155-
},
156-
p95Duration: {
157-
current: 1800,
158-
previous: 1700,
118+
baseline: 1400,
159119
change: 100,
160120
},
161-
appearsInRuns: 8,
121+
executedInRuns: 8,
162122
},
163123
},
164124
{
@@ -169,30 +129,20 @@ describe("CTRF Helpers", () => {
169129
insights: {
170130
flakyRate: {
171131
current: 0.1,
172-
previous: 0.1,
132+
baseline: 0.1,
173133
change: 0.0,
174134
},
175135
failRate: {
176136
current: 0.2,
177-
previous: 0.2,
178-
change: 0.0,
179-
},
180-
skippedRate: {
181-
current: 0.0,
182-
previous: 0.0,
137+
baseline: 0.2,
183138
change: 0.0,
184139
},
185140
averageTestDuration: {
186141
current: 800,
187-
previous: 800,
188-
change: 0,
189-
},
190-
p95Duration: {
191-
current: 900,
192-
previous: 900,
142+
baseline: 800,
193143
change: 0,
194144
},
195-
appearsInRuns: 10,
145+
executedInRuns: 10,
196146
},
197147
},
198148
];
@@ -236,7 +186,7 @@ describe("CTRF Helpers", () => {
236186
expect(
237187
result.every(
238188
(test: Test) =>
239-
test.insights?.flakyRate.current &&
189+
test.insights?.flakyRate?.current &&
240190
typeof test.insights.flakyRate.current === "number" &&
241191
test.insights.flakyRate.current > 0,
242192
),
@@ -534,7 +484,7 @@ describe("CTRF Helpers", () => {
534484
expect(
535485
result.every(
536486
(test: Test) =>
537-
test.insights?.failRate.current &&
487+
test.insights?.failRate?.current &&
538488
typeof test.insights.failRate.current === "number" &&
539489
test.insights.failRate.current > 0,
540490
),

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "handlebars-helpers-ctrf",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "A collection of Handlebars helpers for working with Common Test Report Format",
55
"type": "module",
66
"main": "dist/index.js",
@@ -37,7 +37,7 @@
3737
"license": "MIT",
3838
"dependencies": {
3939
"ansi-to-html": "^0.7.2",
40-
"ctrf": "^0.0.13-next.0",
40+
"ctrf": "^0.0.13",
4141
"handlebars": "^4.7.8",
4242
"minimatch": "^10.0.3"
4343
},

0 commit comments

Comments
 (0)