-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use bashunit for e2e tests #3160
Conversation
I'd rather install it with a script for a specific version than had it commited https://bashunit.typeddevs.com/installation |
This pull request has been marked as ready for review. |
I have no idea what the assert.sh script does. I'm not a bash expert. I'd like to hear from Bashunit creators on this. |
@ondrejmirtes @staabm you can use Allow calling assertions outside tests #258 by installing the beta for now (which uses main branch) -> https://bashunit.typeddevs.com/installation#install-sh and later on use the next official release (which would be out in a week or two). This way, you can start working on this and you aren't block from bashunit anymore :) |
[ $(echo "$OUTPUT" | wc -l) -eq 2 ] | ||
grep 'Method TraitsCachingIssue\\TestClassUsingTrait::doBar() should return stdClass but returns Exception.' <<< "$OUTPUT" | ||
grep 'Method class@anonymous/TestClassUsingTrait.php:20::doBar() should return stdClass but returns Exception.' <<< "$OUTPUT" | ||
../bashunit -a line_count 2 "$OUTPUT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to reproduce it locally, so I cloned your fork (git@github.com:Chemaclass/staabm-phpstan-src.git
), checkout your bashunit branch, and I get this error when running composer install - which I think it shouldn't happen as it is a virgin start (I also set php 8.1), so I guess there is a problem on the deps? Did you face the same issue, @staabm ? Any idea how to find a work around to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the README.
If you encounter dependency problem, try using
export COMPOSER_ROOT_VERSION=1.11.x-dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can reproduce on the CLI outside of phpstan repo with:
OUTPUT="one\ntwo\nthree"
➜ echo $OUTPUT
one
two
three
➜ ./bashunit -a line_count 3 "$OUTPUT"
✗ Failed: Main::exec assert
Expected 'one\ntwo\nthree'
to contain number of lines equal to '3'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, in such a case the bug seems to be in the assert_line_count
where it might consider that as 1 line and not as 3. I think that's the direction of the 🐛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm .. the unit test regarding it looked good:
https://github.com/TypedDevs/bashunit/pull/259/files#diff-8c5ca8e706f9d9fb330cda7953d707bb4180b68f55fdff87ec30ad3f8e179ad6R339-R341
I don't know bash good enough, but I had a feeling the problem is related to the assertion via args passing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can reproduce it, yes. This is a bashunit issue, I will work on it today 🏗️
UPDATE: It took me a couple of hours... but finally I got something out: TypedDevs/bashunit#265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, TypedDevs/bashunit#265 is merged and we are getting closer to the light!
Can you try again to reproduce it with the latest beta, @staabm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest error, I think we might have found a major problem wrt multiline strings mmmm I have an idea, but it might take a while... let me see if I can create a draft for this today 🏗️
UPDATE: This might be the fix for the multiline string bug: TypedDevs/bashunit#266
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same drill: TypedDevs/bashunit#266 is merged, can you try the latest beta again, @staabm? 🤞🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Chemaclass all e2e are green now. thank you very much for your efforts <3.
@ondrejmirtes this one is good to go now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 🙌 For now, you can use the beta which contains the new working functionality that you need, and in the coming days, once we launch the new release, then you can pin it to the latest stable instead of beta.
Anything you need, here we are!
Awesome! @staabm Please send an update once a stable release comes out. |
Thank you! |
No description provided.