Giter VIP home page Giter VIP logo

php-diff-test's Introduction

PHP Diff Test

Run only the tests that cover lines that have been changed.

Install

composer require --dev brianhenryie/php-diff-test

Run

Run: phpunit --filter="$(phpdifftest)" or codecept run suitename "$(phpdifftest)"

How it works

Runs git diff, parses which lines have been changed, parses *.cov codecoverage files to match which tests cover those lines.

The script looks in the current working directory, its tests subfolder, and each of the tests immediate subfolders for *.cov.

It also checks tests for Codeception *.suite.y*ml files, and assumes a file named unit.cov corresponds with unit.suite.yml to determine should the output be formatted for codecept run... syntax rather than PHPUnit --filter="..." syntax.

Obviously, it's assumed you're working inside a Git repo and have previously generated code coverage.

TODO

  • I think the diff doesn't track unstaged/uncommitted files which could have code coverage
  • Also run tests changed in the diff / run all tests changed since the code coverage was generated (merge/increment coverage?)
  • Allow specifying a hash to diff with – i.e. make pull requests run faster
  • sebastianbergmann/php-code-coverage#571 – code coverage annotations make this tool less thorough
  • Tidy up the code – I'm not sure is the diff report's lines the current lines or the before lines... use both for best effect
  • Tests!

php-diff-test's People

Contributors

brianhenryie avatar

Stargazers

Cyrille C. avatar Brian Alexander avatar Leonardo Losoviz avatar Vasily Pyatykh avatar

Watchers

James Cloos avatar  avatar  avatar

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.