cypress-json-results
Advanced tools
Comparing version 1.4.0 to 1.5.0
{ | ||
"name": "cypress-json-results", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Saves Cypress test results as a JSON file", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -106,2 +106,8 @@ # cypress-json-results [![Build status][ci image]][ci url] [![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-12.13.0-brightgreen) | ||
![Spec table](./images/spec.png) | ||
Value `githubActionsSummary: 'test'` writes a single row per test. | ||
![Tests table](./images/tests.png) | ||
## Cypress test counts | ||
@@ -108,0 +114,0 @@ |
@@ -7,3 +7,3 @@ /// <reference types="cypress" /> | ||
const ghCore = require('@actions/core') | ||
const { getSpecEmoji } = require('./utils') | ||
const { getSpecEmoji, getStateEmoji } = require('./utils') | ||
@@ -78,3 +78,2 @@ function registerCypressJsonResults(options = {}) { | ||
const emoji = getSpecEmoji(specState) | ||
console.log('%s %s %s', specName, specState, emoji) | ||
return [specName, emoji] | ||
@@ -98,2 +97,29 @@ }) | ||
.write() | ||
} else if (options.githubActionsSummary === 'test') { | ||
delete allResults.totals | ||
const specs = Object.keys(allResults) | ||
const specRows = [] | ||
specs.forEach((specName) => { | ||
const tests = allResults[specName] | ||
const testNames = Object.keys(tests) | ||
const testN = testNames.length | ||
specRows.push([ | ||
{ data: specName, header: true }, | ||
{ data: String(testN), header: true }, | ||
]) | ||
testNames.forEach((testTitle) => { | ||
const testState = tests[testTitle] | ||
const emoji = getStateEmoji(testState) | ||
specRows.push([testTitle, emoji]) | ||
}) | ||
}) | ||
ghCore.summary | ||
.addHeading('Individual test results') | ||
.addTable([...specRows]) | ||
.addLink( | ||
'bahmutov/cypress-json-results', | ||
'https://github.com/bahmutov/cypress-json-results', | ||
) | ||
.write() | ||
} | ||
@@ -100,0 +126,0 @@ }) |
11401
168
176