psalm / codeception-psalm-module Goto Github PK
View Code? Open in Web Editor NEWCodeception module providing assertions and Gherkin snippets to help with Psalm acceptance testing
License: MIT License
Codeception module providing assertions and Gherkin snippets to help with Psalm acceptance testing
License: MIT License
Can you please bump the requirements of this lib.
The easy one is
"composer/semver": "^1.4 || ^2.0 || ^3.0"
Hey there,
I recently stumbled upon a problem which I wanted to fix. I debugged stuff, etc. and while debugging I was using --no-cache
and was unable to reproduce the problem. I then found out that psalm is executed without --no-cache
here which is kinda problematic in some cases (i.e. when using codecept run --fail-fast
which keeps the _run
directory).
I'd like to propose adding --no-cache
to the psalm CLI execution command so that there are no sideeffects from whatever caches.
๐ I noticed that my Codeception tests pass even if I expect a different type of error from psalm.
Steps To Reproduce
Write a gherkin test snippet and include Then I see these errors
in the test. Expect a specific error such as | MissingFile | Cannot find file |
when require_once file/that/doesn't/exist.php
is analyzed.
An example is here: psalm/psalm-plugin-laravel@d69377b#diff-dc52f1aabf7e9388e148c112a4b349c1R32
Expected
UnresolvableInclude
was returned by psalm instead of the expected MissingFile
Actual
If the psalm process executed does not run successfully, the codeception test will still pass.
Here is some output from a plugin test that I was developing, with --debug
.
When i run psalm
I run psalm
Moved to /Users/fiachra/repos/psalm-plugin-laravel/tests/_run
Current version: 3.10.1
Comparing 3.10.1.0 >= 3.4.0.0 => 1
Running: /Users/fiachra/repos/psalm-plugin-laravel/vendor/vimeo/psalm/psalm --output-format=json --no-progress
PHP Fatal error: Cannot declare class Illuminate\Support\Collection, because the name is already in use in /Users/fiachra/repos/psalm-plugin-laravel/src/Stubs/Collection.stubphp on line 11
Fatal error: Cannot declare class Illuminate\Support\Collection, because the name is already in use in /Users/fiachra/repos/psalm-plugin-laravel/src/Stubs/Collection.stubphp on line 11
In Collection.stubphp line 11:
Cannot declare class Illuminate\Support\Collection, because the name is already in use
Moved to /Users/fiachra/repos/psalm-plugin-laravel
Then i see no errors
I can see no errors
PASSED
I would expect this codeception test to fail. If the debug flag is not passed, then there is no indication that psalm did not run successfully.
Error when running tests:
1) Psalm module: Running with no errors
Test tests/acceptance/PsalmModule.feature:Running with no errors
Step Can see no errors
Fail There were errors:
| ConfigIssue | Attribute "totallyTyped" is deprecated and is going to be removed in the next major version |
๐
Idea: Allow invoking psalm with xdebug enabled so that we can debug codeception tests. This is very helpful for me while writing new functionality in the laravel plugin.
The cmd
will need to be changed to something like PSALM_ALLOW_XDEBUG=1 /usr/local/bin/php ' . $this->config['psalm_path']
... This works for me locally, but I'm not sure if it will work cross platform, etc.
I think we will also need to set vendor/vimeo/psalm/src/psalm.php
as the psalm path, instead of just vendor/bin/psalm
๐ This is very much an edge case that I am trying to test: psalm/psalm-plugin-laravel#56 Essentially i want to expect psalm to fail, and assert that the status code is not 0.
We could accomplish this is by asserting a non-zero response code in seeTheseErrors
. What do you think?
Running codecept
via a docker run
command in a Makefile
with the --user $(shell id -u):$(shell id -g)
command seems to have your codeception psalm function be unable to create cache directories, despite psalm having no issue creating cache directories when run directly under a similar command.
Is there something in particular I'm missing here?
Having a bit of a problem at the dayjob; have got this psalm module integrated with a plugin for tests, but getting 0% coverage despite tests passing.
Any ideas where I might go looking?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.