Giter VIP home page Giter VIP logo

rspec_flat_error_formatter's Introduction

WARNING

Unfortunately, this gem is discontinued and won't get any support from me anymore ๐Ÿ˜’. Thanks for the attention.

RspecFlatErrorFormatter

Build Status

RSpec formater that produces errors output easily consumable by automated tools

Rationale

Initially, this tool came out as an attempt to use the Visual Studio Code tasks for running the RSpec and scanning its output to locate and test the failing specs very quickly. VS Code offers the mechanism of problem matchers that are, in fact, regular expressions to filter the output of a task line by line and feed the extracted info to the Problems view.

Requirements

The following MRI Ruby versions are officially supported:

  • 2.1
  • 2.2
  • 2.3
  • 2.4
  • 2.5

Although it's not recommended to use 2.1 or 2.2 as their support period has ended. The are no plans to support JRuby or Rubinius for now. But if the community has a strong request for it, it will likely be added.

Installation

Add this line to your application's Gemfile:

gem 'rspec_flat_error_formatter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec_flat_error_formatter

Usage

Basic

Pass as a value of the --format (or -f) option to the RSpec:

$ bundle exec rspec --format RSpecFlatErrorFormatter

Or add as to the default set of options via .rspec file:

--format RSpecFlatErrorFormatter

Now run the tests as usual:

$ bundle exec rspec

After you've configured the formatter to be used by RSpec, you can consume its output by the tools you have to automate your test results navigation.

VS Code tasks

Here's an example of configuring rspec and guard-rspec using VS Code tasks to consume the output of RspecFlatErrorFormatter.

Create a .vscode dir under your project or workspace dir. Then, create a tasks.json file under it with the following contents:

{
  "version": "2.0.0",
  "tasks": [
    // rspec
    {
      "label": "rspec",
      "type": "shell",
      "command": "rspec",
      "group": "test",
      "presentation": {
        "echo": true,
        "reveal": "always"
      },
      "problemMatcher": {
        "fileLocation": ["relative", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(\\./.*?\\.rb):(\\d+?):\\s(error|info):\\s(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      }
    },
    // guard-rspec
    {
      "label": "guard",
      "type": "shell",
      "command": "bundle exec guard",
      "presentation": {
        "echo": true,
        "reveal": "always",
        "panel": "dedicated"
      },
      "isBackground": true,
      "problemMatcher": {
        "fileLocation": ["relative", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(\\./.*?\\.rb):(\\d+?):\\s(error|info):\\s(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        },
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^\\d{2}:\\d{2}:\\d{2} - INFO - Running",
          "endsPattern": "^Randomized with"
        }
      }
    }
  ]
}

Development

After checking out the repo, run bundle exec rake spec to run the tests.

To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vittorius/rspec_flat_error_formatter.

License

The gem is available as open source under the terms of the MIT License.

Kudos

  • @sj26 for his beautiful rspec_junit_formatter - tests organization and some other stuff in repo are under the huge influence of RSpec JUnit Formatter repo

rspec_flat_error_formatter's People

Contributors

vittorius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rspec_flat_error_formatter's Issues

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.