GithubHelp home page GithubHelp logo

vbanthia-zz / rspec_html_reporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kingsleyh/rspec_reports_formatter

32.0 2.0 15.0 2.85 MB

Rspec custom formatter to produce beautiful reports from rspec

Home Page: https://vbanthia.github.io/rspec_html_reporter/index.html

License: MIT License

Ruby 60.28% HTML 39.03% Gherkin 0.69%
ruby rspec reporter

rspec_html_reporter's People

Stargazers

Rohit Trivedi avatar Daniel Junior avatar  avatar Miguel Benítez avatar Dmytro Samodurov avatar TAKATSUTO Atsushi avatar Takuhiro Fujikawa avatar Gan Yi Zhong avatar Yoshihiro Saito avatar Hideyuki Nanashima avatar koricho avatar  avatar Boccham avatar kalvin avatar  avatar Ehab Hammoudeh avatar bundai223 avatar s.yakushi avatar uuushiro avatar Fohte / Hayato Kawai avatar Akira Kusumoto avatar Naokazu Terada avatar Nick Soto avatar Koji Hasegawa avatar Mori Atsushi avatar Taiga Tsutsumi avatar Isao Kono avatar Tomoya Tabuchi avatar Tadashi Nemoto avatar Dai Fujihara avatar Vishal Banthia avatar Fedor Barannik avatar

Watchers

Reinaldo Rossetti avatar  avatar

rspec_html_reporter's Issues

How to configure the html rendered

I am trying to change the ui as per my project requirements.Please let me know what to edit or more specifically how it reads the tests and creates reports.

Duplicate descriptions overwrite reports

If a project has 2 tests with the same top level description, the html reports will overwrite one another.
In which case, the html report can show all tests passing, even though some tests are failing.
Additionally, it will show incorrect test counts.

I have an example project here:
https://github.com/micahtessler/example_rspec_reporting

if you run bundle exec rspec spec
You will see 2 tests, with 1 failure

if you run bundle exec rspec spec --format RspecHtmlReporter and look at overview.html, then it will show only one test having been run, whichever ran second.

Specs missing for external shared examples

Given:

# spec/shared_example_spec.rb
RSpec.describe "Example Group Including Examples" do
  include_examples "from another file", :should_pass
  include_examples "from another file", :should_fail
end

# spec/support/shared_examples/from_another_file.rb
RSpec.shared_examples "from another file" do |expected|
  it "works" do
    #-> Given a shared example with spec
    expect(expected).to eq(:should_pass)
  end
end

Behavior:
screen shot 2018-09-10 at 8 14 16 pm

Expected:
screen shot 2018-09-10 at 8 14 38 pm

Triage:
The v1.0.0 implementation for parsing example specs from sourcecode assumes:

  1. all examples in an example group are from the same file (Addressed in v1.0.1)
  2. examples in an example group will be lexically ordered in that same file

My PR to address this bug: #8.

It includes a test case that demonstrates that the second assumption fails when using the same shared example twice in a row. (There are other failure modes, but this one is the simplest.)

Throw exception when using on windows

rspec_html_reporter.rb at line 60

if os == :windows
  file_path = data[0] + ':' + data[1]
  line_number = data[2].to_i
else
  file_path = data.first
  line_number = data[1].to_i
end

I ran on windows, and using rspec with version 3.8.0, found that get file_path & line_number should be same with other OS, like:

file_path = data.first
line_number = data[1].to_i

Otherwise, it will throw exception : No such file Error at line 67: lines = File.readlines(file_path)

Please kindly confirm it, thanks.

Release version for latest master commit

Hi, I am wondering if you could release a version (can be patch release) for 124be31.

I am running into the Multiple Exception Error that that commit fixes, and it would be nice to be able to pull it as a stable version from the gem.

Thanks!

Text is not escaped in backtrace

Hello,

With the recent change to how backtrace is shown on report page it looks like escaping < and > was missed:

<li>./spec/admin/basic/new_admin_spec.rb:10:in `block (2 levels) in <top (required)>'</li>

< not being escaped causes the report to render incompletely.

Reporter fails for shared_examples from other files

Generating a report fails when shared_examples are coming from a separate file and context has its own it, the reporter fails with:

NoMethodError: private method `select' called for nil:NilClass
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:148:in `block in process'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:144:in `each'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:144:in `each_with_index'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:144:in `process'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:235:in `block in example_group_finished'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:217:in `open'
  /home/nelchael/.gem/ruby/gems/rspec_html_reporter-1.0.0/lib/rspec_html_reporter.rb:217:in `example_group_finished'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:201:in `block in notify'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:200:in `each'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:200:in `notify'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:115:in `example_group_finished'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/example_group.rb:603:in `run'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:116:in `block (3 levels) in run_specs'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:116:in `map'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:116:in `block (2 levels) in run_specs'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1989:in `with_suite_hooks'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:111:in `block in run_specs'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:74:in `report'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:110:in `run_specs'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:87:in `run'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:71:in `run'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:45:in `invoke'
  /home/nelchael/.gem/ruby/gems/rspec-core-3.8.0/exe/rspec:4:in `<top (required)>'
  /home/nelchael/.gem/ruby/bin/rspec:23:in `load'
  /home/nelchael/.gem/ruby/bin/rspec:23:in `<top (required)>'

Steps to reproduce:

  1. Create Gemfile:
source "https://rubygems.org"
gem "rspec", "~> 3.8.0"
gem "rspec_html_reporter", ">= 1.0.0"
  1. Create context.rb:
#!/usr/bin/ruby

RSpec.shared_examples "foo" do |arg|
  it "works" do
    expect("foo-bar-baz").to eq(arg)
  end
end
  1. Create spec.rb:
#!/usr/bin/ruby

require_relative "context"

RSpec.describe "an example group" do
  include_examples "foo", "foo-bar-baz"

  it "works again" do
    expect("foo").to eq("foo")
  end
end
  1. bundle install
  2. bundle exec rspec --format d --format RspecHtmlReporter ./spec.rb

Moving the shared_examples block into spec.rb seems to fix this, but obviously is not a solution for sharing code between multiple spec files.

Save reports on another machine

Hello,
instead of saving the reports locally, where the test scripts are located, is it possible to provide a URL to another machine/server to save the reports there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.