GithubHelp home page GithubHelp logo

Missing support to Infection PHP about pest HOT 11 CLOSED

pestphp avatar pestphp commented on August 19, 2024 3
Missing support to Infection PHP

from pest.

Comments (11)

maks-rafalko avatar maks-rafalko commented on August 19, 2024 8

Hello, Infection's creator here.

Thanks for looking into this and creating this issue.

@owenvoke can you please share an adapter you created for Pest? I wonder how you deal with TestFrameworkAdapter interface and determining whether the test failed or not.

Regarding adapter: I would suggest creating an official repository at infection/pest-adapter to be in line with already 3 implemented:

  • infection/phpspec-adapter
  • infection/codeception-adapter
  • phpunit adapter (currently bundled into the core - infection/infection

You can be maintainers of this repo if that matters.

Why "official" repository is better? because

FYI, adapters should have a special composer package's type infection-extension to be autodiscovered and autoinstallable by our extensions-installer, e.g. see https://github.com/infection/codeception-adapter/blob/09dda58180bc3ba7ca3cb865ba0d0d84dfe3ef5a/composer.json#L4

Didn't dig into the Pest yet, but test framework should have some required features to be able to work efficiently with Infection, some of them are described here infection/infection#45 (comment). I guess if the Pest is just a wrapper for PHPUnit and works with PHPUnit's config, it shouldn't be an issue.

Anyway, I'm happy to help here.

from pest.

owenvoke avatar owenvoke commented on August 19, 2024 2

I might take a quick look at this tomorrow, just to see how it's done. 👍

from pest.

nunomaduro avatar nunomaduro commented on August 19, 2024 1

@owenvoke I guess we can create our own repository for this. Let's call it pest-plugin-infection.

from pest.

nunomaduro avatar nunomaduro commented on August 19, 2024 1

Alright, I love infection - but at the moment I've no plans to work on this. Hopefully in the future someone will pick this.

from pest.

nunomaduro avatar nunomaduro commented on August 19, 2024 1

@tomasnorre Yeah - unfortunately my free time is very limited. And of course, someone else that needs infection in their test suite can submit a pull request that addresses this issue.

from pest.

tomasnorre avatar tomasnorre commented on August 19, 2024 1

I totally get that, I wasn't meant as a blame, was just hoping for it.

We just started using pest and I think that mutation tests are really valuable. Perhaps I get to the point where I will make a PR. But like you, I have limited free time too :)

Stay safe and take care.

from pest.

owenvoke avatar owenvoke commented on August 19, 2024

Right, I've taken a look and this is probably going to be complicated.

New adapters are created as an additional repository, I was thinking of a pestphp/infection-adapter or, if Infection want to have it, an infection/pest-adapter package. I've created a test version that is partially working, after making sure it uses the right executable, etc.

However it looks like the TestFrameworkConfigLocator class is hardcoded to use {path}/{frameworkName}.{extension}, whereas Pest uses the phpunit.xml/phpunit.xml.dist file. 😕 I can get round this by copying the phpunit.xml.dist to pest.xml.dist.

But after that, and some tweaking (hacks?)...

Preview of Pest with Infection!

from pest.

nunomaduro avatar nunomaduro commented on August 19, 2024

This afternoon I going to create the template for that repository. Give me a couple hours.

from pest.

owenvoke avatar owenvoke commented on August 19, 2024

It looks like the only changes we'd need to PR to Infection is to add a Pest constant and entry to the TYPES constant in TestFrameworkTypes. 🎉 (At least, in master)

from pest.

theofidry avatar theofidry commented on August 19, 2024

@maks-rafalko I think it's also an opportunity to adapt the config locator.

I don't think it makes sense anymore to have it in the core with hard-coded path when its responsibility is to locate the test framework config path, which depends on the test framework itself.

One way would be to move the interface directly in https://github.com/infection/abstract-testframework-adapter or it could even be completely hidden in the adapter, leaving the responsibility to have a dedicated class for that or not to each individual adapters. A non trivial question though is how all of that should interact with the TestFrameworkConfigPathProvider (used for initializing Infection).

from pest.

tomasnorre avatar tomasnorre commented on August 19, 2024

Missing a sad smiley. But you are the maintainer, it's your call.

from pest.

Related Issues (20)

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.