Skip to content

Commit cbf266c

Browse files
fix: Include run.stats.skipped in results (#27695)
Co-authored-by: Matt Schile <mschile@cypress.io>
1 parent 05afa1e commit cbf266c

File tree

7 files changed

+112
-20
lines changed

7 files changed

+112
-20
lines changed

cli/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ _Released 09/12/2023 (PENDING)_
55

66
**Features:**
77

8-
- Introduce a status icon representing the `latest` test run in the Sidebar for the Runs Page. Addresses [#27206](https://github.com/cypress-io/cypress/issues/27206).
8+
- Introduces a status icon representing the `latest` test run in the Sidebar for the Runs Page. Addresses [#27206](https://github.com/cypress-io/cypress/issues/27206).
9+
10+
**Bugfixes:**
11+
12+
- Fixed a regression introduced in Cypress [13.0.0](#13-0-0) where the [Module API](https://docs.cypress.io/guides/guides/module-api), [`after:run`](https://docs.cypress.io/api/plugins/after-run-api), and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) results did not include the `stats.skipped` field for each run result. Fixes [#27694](https://github.com/cypress-io/cypress/issues/27694). Addressed in [#27695](https://github.com/cypress-io/cypress/pull/27695).
913

1014
## 13.0.0
1115

cli/types/cypress-npm-api.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ declare namespace CypressCommandLine {
246246
failures: number
247247
passes: number
248248
pending: number
249+
skipped: number
249250
startedAt: dateTimeISO
250251
suites: number
251252
tests: number

packages/driver/cypress/e2e/e2e/dom_hitbox.cy.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('rect highlight', { browser: '!webkit' }, () => {
8484
})
8585

8686
const ensureCorrectTargetPosition = (sel) => {
87-
return cy.wrap(null, { timeout: 400 }).should(() => {
87+
return cy.wrap(null, { timeout: 4000 }).should(() => {
8888
const target = cy.$$('div[data-highlight-hitbox]')[0].getBoundingClientRect()
8989

9090
const dims = {
@@ -101,7 +101,7 @@ const ensureCorrectTargetPosition = (sel) => {
101101
}
102102

103103
const ensureCorrectHighlightPositions = (sel) => {
104-
return cy.wrap(null, { timeout: 400 }).should(() => {
104+
return cy.wrap(null, { timeout: 4000 }).should(() => {
105105
const els = {
106106
content: cy.$$('div[data-layer=Content]'),
107107
padding: cy.$$('div[data-layer=Padding]'),

packages/server/lib/modes/results.ts

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ const createPublicRun = (run: RunResult): CypressCommandLine.RunResult => ({
134134
failures: run.stats.failures,
135135
passes: run.stats.passes,
136136
pending: run.stats.pending,
137+
skipped: run.stats.skipped,
137138
startedAt: run.stats.wallClockStartedAt,
138139
suites: run.stats.suites,
139140
tests: run.stats.tests,

system-tests/__snapshots__/results_spec.ts.js

+93-16
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ exports['module api and after:run results'] = `
153153
"failures": 1,
154154
"passes": 2,
155155
"pending": 0,
156+
"skipped": 0,
156157
"startedAt": "2015-03-18T00:00:00.000Z",
157158
"suites": 1,
158159
"tests": 3
@@ -210,11 +211,11 @@ exports['module api and after:run results'] = `
210211
"error": null,
211212
"reporter": "spec",
212213
"reporterStats": {
213-
"suites": 1,
214-
"tests": 2,
214+
"suites": 2,
215+
"tests": 4,
215216
"passes": 1,
216217
"pending": 0,
217-
"failures": 1,
218+
"failures": 2,
218219
"start": "2015-03-18T00:00:00.000Z",
219220
"end": "2015-03-18T00:00:00.000Z",
220221
"duration": 100
@@ -254,6 +255,13 @@ exports['module api and after:run results'] = `
254255
"path": "/path/to/path",
255256
"takenAt": "2015-03-18T00:00:00.000Z",
256257
"width": 1000
258+
},
259+
{
260+
"height": 720,
261+
"name": null,
262+
"path": "/path/to/path",
263+
"takenAt": "2015-03-18T00:00:00.000Z",
264+
"width": 1280
257265
}
258266
],
259267
"spec": {
@@ -266,12 +274,13 @@ exports['module api and after:run results'] = `
266274
"stats": {
267275
"duration": 100,
268276
"endedAt": "2015-03-18T00:00:00.000Z",
269-
"failures": 1,
277+
"failures": 2,
270278
"passes": 1,
271279
"pending": 0,
280+
"skipped": 1,
272281
"startedAt": "2015-03-18T00:00:00.000Z",
273-
"suites": 1,
274-
"tests": 2
282+
"suites": 2,
283+
"tests": 4
275284
},
276285
"tests": [
277286
{
@@ -304,19 +313,49 @@ exports['module api and after:run results'] = `
304313
"results spec 1",
305314
"test 2"
306315
]
316+
},
317+
{
318+
"attempts": [
319+
{
320+
"state": "failed"
321+
}
322+
],
323+
"displayError": ""Error: failure in beforeEach\\n\\nBecause this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`has skipped tests\`\\n <stack lines>"
324+
"duration": 100,
325+
"state": "failed",
326+
"title": [
327+
"results spec 1",
328+
"has skipped tests",
329+
"will be skipped #1"
330+
]
331+
},
332+
{
333+
"attempts": [
334+
{
335+
"state": "skipped"
336+
}
337+
],
338+
"displayError": null,
339+
"duration": 100,
340+
"state": "skipped",
341+
"title": [
342+
"results spec 1",
343+
"has skipped tests",
344+
"will be skipped #2"
345+
]
307346
}
308347
],
309348
"video": null
310349
}
311350
],
312351
"startedTestsAt": "2015-03-18T00:00:00.000Z",
313352
"totalDuration": 100,
314-
"totalFailed": 2,
353+
"totalFailed": 3,
315354
"totalPassed": 3,
316355
"totalPending": 0,
317-
"totalSkipped": 0,
318-
"totalSuites": 2,
319-
"totalTests": 5
356+
"totalSkipped": 1,
357+
"totalSuites": 3,
358+
"totalTests": 7
320359
}
321360
`
322361

@@ -333,11 +372,11 @@ exports['after:spec results'] = `
333372
"error": null,
334373
"reporter": "spec",
335374
"reporterStats": {
336-
"suites": 1,
337-
"tests": 2,
375+
"suites": 2,
376+
"tests": 4,
338377
"passes": 1,
339378
"pending": 0,
340-
"failures": 1,
379+
"failures": 2,
341380
"start": "2015-03-18T00:00:00.000Z",
342381
"end": "2015-03-18T00:00:00.000Z",
343382
"duration": 100
@@ -377,6 +416,13 @@ exports['after:spec results'] = `
377416
"path": "/path/to/path",
378417
"takenAt": "2015-03-18T00:00:00.000Z",
379418
"width": 1000
419+
},
420+
{
421+
"height": 720,
422+
"name": null,
423+
"path": "/path/to/path",
424+
"takenAt": "2015-03-18T00:00:00.000Z",
425+
"width": 1280
380426
}
381427
],
382428
"spec": {
@@ -389,12 +435,13 @@ exports['after:spec results'] = `
389435
"stats": {
390436
"duration": 100,
391437
"endedAt": "2015-03-18T00:00:00.000Z",
392-
"failures": 1,
438+
"failures": 2,
393439
"passes": 1,
394440
"pending": 0,
441+
"skipped": 1,
395442
"startedAt": "2015-03-18T00:00:00.000Z",
396-
"suites": 1,
397-
"tests": 2
443+
"suites": 2,
444+
"tests": 4
398445
},
399446
"tests": [
400447
{
@@ -427,6 +474,36 @@ exports['after:spec results'] = `
427474
"results spec 1",
428475
"test 2"
429476
]
477+
},
478+
{
479+
"attempts": [
480+
{
481+
"state": "failed"
482+
}
483+
],
484+
"displayError": ""Error: failure in beforeEach\\n\\nBecause this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`has skipped tests\`\\n <stack lines>"
485+
"duration": 100,
486+
"state": "failed",
487+
"title": [
488+
"results spec 1",
489+
"has skipped tests",
490+
"will be skipped #1"
491+
]
492+
},
493+
{
494+
"attempts": [
495+
{
496+
"state": "skipped"
497+
}
498+
],
499+
"displayError": null,
500+
"duration": 100,
501+
"state": "skipped",
502+
"title": [
503+
"results spec 1",
504+
"has skipped tests",
505+
"will be skipped #2"
506+
]
430507
}
431508
],
432509
"video": null

system-tests/projects/results/cypress/e2e/spec-2.cy.js

+9
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ describe('results spec 1', () => {
1717
cy.log('test 2')
1818
cy.screenshot('test 2 screenshot')
1919
})
20+
21+
describe('has skipped tests', { retries: 0 }, () => {
22+
beforeEach(() => {
23+
throw new Error('failure in beforeEach')
24+
})
25+
26+
it('will be skipped #1', () => {})
27+
it('will be skipped #2', () => {})
28+
})
2029
})

system-tests/test/results_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('module api, after:spec, and after:run results', () => {
4646
project: 'results',
4747
browser: 'electron',
4848
outputPath,
49-
expectedExitCode: 2,
49+
expectedExitCode: 3,
5050
config: {
5151
retries: 2,
5252
},

0 commit comments

Comments
 (0)