Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dorny/test-reporter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.8.0
Choose a base ref
...
head repository: dorny/test-reporter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.9.0
Choose a head ref
  • 11 commits
  • 13 files changed
  • 3 contributors

Commits on Feb 25, 2024

  1. Update repository address to current URL

    jozefizso authored Feb 25, 2024
    Copy the full SHA
    ccc63b8 View commit details

Commits on Mar 7, 2024

  1. Merge pull request #385 from dorny/fix/package_repository_url

    jozefizso authored Mar 7, 2024
    Copy the full SHA
    7e5f292 View commit details

Commits on Mar 13, 2024

  1. Add support for rspec

    oscarmampel committed Mar 13, 2024
    Copy the full SHA
    1a3cfe6 View commit details

Commits on Apr 2, 2024

  1. Merge pull request #398 from oscarmampel/main

    jozefizso authored Apr 2, 2024
    Copy the full SHA
    4cd9c62 View commit details
  2. Copy the full SHA
    1212842 View commit details
  3. Copy the full SHA
    0863296 View commit details
  4. Copy the full SHA
    99e65e6 View commit details
  5. Build the distribution file

    jozefizso committed Apr 2, 2024
    Copy the full SHA
    80874c1 View commit details

Commits on Apr 3, 2024

  1. Merge pull request #405 from dorny/feature/update_packages

    jozefizso authored Apr 3, 2024
    Copy the full SHA
    82b258b View commit details

Commits on Apr 5, 2024

  1. test-reporter release v1.9.0

    jozefizso committed Apr 5, 2024
    Copy the full SHA
    9a5ccba View commit details
  2. Merge pull request #416 from dorny/release/v1.9.0

    jozefizso authored Apr 5, 2024
    Copy the full SHA
    c40d89d View commit details
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -142,6 +142,7 @@ jobs:
# java-junit
# jest-junit
# mocha-json
# rspec-json
reporter: ''
# Allows you to generate only the summary.
16 changes: 16 additions & 0 deletions __tests__/__outputs__/rspec-json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%201%20failed%2C%201%20skipped-critical)
## ❌ <a id="user-content-r0" href="#r0">fixtures/rspec-json.json</a>
**3** tests were completed in **0ms** with **1** passed, **1** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[./spec/config/check_env_vars_spec.rb](#r0s0)|1✅|1❌|1⚪|0ms|
### ❌ <a id="user-content-r0s0" href="#r0s0">./spec/config/check_env_vars_spec.rb</a>
```
CheckEnvVars#call when all env vars are defined behaves like success load
❌ CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion
(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug("All config env vars exist")
expected: 0 times with arguments: ("All config env vars exist")
received: 1 time with arguments: ("All config env vars exist")
✅ CheckEnvVars#call when all env vars are defined behaves like success load logs success message
⚪ CheckEnvVars#call when all env vars are defined behaves like success load skips the test
```
49 changes: 49 additions & 0 deletions __tests__/__snapshots__/rspec-json.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`rspec-json tests report from ./reports/rspec-json test results matches snapshot 1`] = `
TestRunResult {
"path": "fixtures/rspec-json.json",
"suites": [
TestSuiteResult {
"groups": [
TestGroupResult {
"name": "CheckEnvVars#call when all env vars are defined behaves like success load",
"tests": [
TestCaseResult {
"error": {
"details": "/usr/local/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1603:in \`initialize'
./config/check_env_vars.rb:11:in \`call'
./spec/config/check_env_vars_spec.rb:7:in \`block (3 levels) in <top (required)>'
./spec/config/check_env_vars_spec.rb:19:in \`block (4 levels) in <top (required)>'",
"line": 11,
"message": "(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug("All config env vars exist")
expected: 0 times with arguments: ("All config env vars exist")
received: 1 time with arguments: ("All config env vars exist")",
"path": "./config/check_env_vars.rb",
},
"name": "CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion",
"result": "failed",
"time": 0.004411051,
},
TestCaseResult {
"error": undefined,
"name": "CheckEnvVars#call when all env vars are defined behaves like success load logs success message",
"result": "success",
"time": 0.079159625,
},
TestCaseResult {
"error": undefined,
"name": "CheckEnvVars#call when all env vars are defined behaves like success load skips the test",
"result": "skipped",
"time": 0.000023007,
},
],
},
],
"name": "./spec/config/check_env_vars_spec.rb",
"totalTime": undefined,
},
],
"totalTime": 0.19118387,
}
`;
17 changes: 17 additions & 0 deletions __tests__/fixtures/empty/rspec-json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "3.13.0",
"messages": [
"No examples found."
],
"examples": [

],
"summary": {
"duration": 0.002514266,
"example_count": 0,
"failure_count": 0,
"pending_count": 0,
"errors_outside_of_examples_count": 0
},
"summary_line": "0 examples, 0 failures"
}
53 changes: 53 additions & 0 deletions __tests__/fixtures/rspec-json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"version": "3.13.0",
"examples": [
{
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:1]",
"description": "logs success message",
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load logs success message",
"status": "passed",
"file_path": "./spec/config/check_env_vars_spec.rb",
"line_number": 12,
"run_time": 0.079159625,
"pending_message": null
},
{
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:2]",
"description": "fails in assertion",
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion",
"status": "failed",
"file_path": "./spec/config/check_env_vars_spec.rb",
"line_number": 17,
"run_time": 0.004411051,
"pending_message": null,
"exception": {
"class": "RSpec::Mocks::MockExpectationError",
"message": "(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug(\"All config env vars exist\")\n expected: 0 times with arguments: (\"All config env vars exist\")\n received: 1 time with arguments: (\"All config env vars exist\")",
"backtrace": [
"/usr/local/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1603:in `initialize'",
"./config/check_env_vars.rb:11:in `call'",
"./spec/config/check_env_vars_spec.rb:7:in `block (3 levels) in \u003ctop (required)\u003e'",
"./spec/config/check_env_vars_spec.rb:19:in `block (4 levels) in \u003ctop (required)\u003e'"
]
}
},
{
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:4]",
"description": "skips the test",
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load skips the test",
"status": "pending",
"file_path": "./spec/config/check_env_vars_spec.rb",
"line_number": 27,
"run_time": 2.3007e-05,
"pending_message": "Temporarily skipped with xit"
}
],
"summary": {
"duration": 0.19118387,
"example_count": 3,
"failure_count": 1,
"pending_count": 1,
"errors_outside_of_examples_count": 0
},
"summary_line": "3 examples, 1 failures, 1 pending"
}
45 changes: 45 additions & 0 deletions __tests__/rspec-json.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as fs from 'fs'
import * as path from 'path'

import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'

describe('rspec-json tests', () => {
it('produces empty test run result when there are no test cases', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'empty', 'rspec-json.json')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})

const opts: ParseOptions = {
parseErrors: true,
trackedFiles: []
}

const parser = new RspecJsonParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result.tests).toBe(0)
expect(result.result).toBe('success')
})

it('report from ./reports/rspec-json test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'rspec-json.json')
const outputPath = path.join(__dirname, '__outputs__', 'rspec-json.md')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})

const opts: ParseOptions = {
parseErrors: true,
trackedFiles: ['test/main.test.js', 'test/second.test.js', 'lib/main.js']
}

const parser = new RspecJsonParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result).toMatchSnapshot()

const report = getReport([result])
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ inputs:
- java-junit
- jest-junit
- mocha-json
- rspec-json
- swift-xunit
required: true
list-suites:
Loading