Giter Club home page Giter Club logo

Comments (8)

weirdan avatar weirdan commented on September 27, 2024 1

This module's dependents may still benefit from having code coverage, so I plan to look into this anyway.

from codeception-psalm-module.

weirdan avatar weirdan commented on September 27, 2024

Can you elaborate on what you're trying to achieve?

from codeception-psalm-module.

SignpostMarv avatar SignpostMarv commented on September 27, 2024

using code coverage to make sure I've got a gherkin snippet for all the test cases I've written in the plugin.

from codeception-psalm-module.

SignpostMarv avatar SignpostMarv commented on September 27, 2024

note for reference: psalm/plugin-phpunit uses this module but doesn't have coverage enabled so I don't have a reference point to figure out what I'm doing wrong :s

from codeception-psalm-module.

weirdan avatar weirdan commented on September 27, 2024

Hm, ok. I don't think it would be easy, if possible at all. What this module does, roughly, is this:

  1. Extract the snippet and combine it with preamble
  2. Put it into a file
  3. Run Psalm on that file and collect the issues it reports
  4. Let you make assertions on the collected issues

Since Psalm is run as an external binary, it's not imediately clear to me how to enable code coverage collection during its run, and how to get coverage data out of it.

from codeception-psalm-module.

weirdan avatar weirdan commented on September 27, 2024

Possibly it could be done by running Psalm like this:

PSALM_ALLOW_XDEBUG=1 php -dauto_prepend_file=start-coverage.php -dauto_append_file=stop-coverage.php $(which psalm) --threads=1

Where start-coverage.php and stop-coverage.php would contain something along the lines of https://github.com/sebastianbergmann/php-code-coverage#usage

Alternatively, a modified copy of c3 (https://github.com/Codeception/c3) could be injected into Psalm environment. As there won't be any webserver running, it would have to be changed to communicate with Codeception by some non-HTTP means.

from codeception-psalm-module.

weirdan avatar weirdan commented on September 27, 2024

The latter approach seem technically feasible:

  • It should be possible to include c3 in an auto_prepend file
  • It should be possible to control it through env vars, e.g.
    HTTP_X_CODECEPTION_CODECOVERAGE=1 PSALM_ALLOW_XDEBUG=1 php -dauto_prepend_file=c3.php $(which psalm) --threads=1 ...
    REQUEST_URI=/c3/phpunit $(which psalm)
    REQUEST_URI=/c3/clear $(which psalm)
    

from codeception-psalm-module.

SignpostMarv avatar SignpostMarv commented on September 27, 2024

@weirdan do you think it'd be more practical to re-open vimeo/psalm#3977 so one could just use phpunit ?

from codeception-psalm-module.

Related Issues (10)

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.