Skip to content
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

ci: Allow for single exercise test exection #849

Merged
merged 4 commits into from
Nov 11, 2024

Conversation

tomasnorre
Copy link
Contributor

I often want to execute only one of the tests in the exercises when adjusting tests, to speed up the process.

This PR will allow me to e.g. run only the tests for exercise book-store by adding an additional parameter.

It can be done in more way.

composer test:run -- book-store
PHPUNIT_BIN='phpunit' bin/test.sh book-store 

I hope this will get accepted as it gives me a better workflow when updating the PHP track.

@tomasnorre tomasnorre marked this pull request as ready for review November 8, 2024 16:48
Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the workflow improvement! That's very welcome.

I haven't tested the suggested change, so take care. Using the -name filter allows wildcards like b*, too. Please test that this works also.

bin/test.sh Outdated Show resolved Hide resolved
@mk-mxp mk-mxp added x:action/improve Improve existing functionality/content x:knowledge/elementary Little Exercism knowledge required x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) x:size/small Small amount of work x:rep/small Small amount of reputation labels Nov 9, 2024
@tomasnorre
Copy link
Contributor Author

Thanks for your feedback, will have a look at in the following days.

@tomasnorre
Copy link
Contributor Author

Using the -name filter allows wildcards like b*, too. Please test that this works also.

This works if b* is wrapped in quotes.

$ composer test:run -- "b*" 

@tomasnorre
Copy link
Contributor Author

I'll have to check why it's failing, will look into it.

@mk-mxp
Copy link
Contributor

mk-mxp commented Nov 10, 2024

It fails, because the shell has set -u (fail on use of unbound variables). Therefore [ $# -ge 1 ] && [ -n "$1" ] is required, as you had it.

Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the contribution workflow! I also missed such functionality when checking changes.

@mk-mxp mk-mxp merged commit 1df6486 into exercism:main Nov 11, 2024
12 checks passed
@tomasnorre tomasnorre deleted the ci-allow-single-test-execution branch November 11, 2024 16:18
tomasnorre added a commit to tomasnorre/exercism-php that referenced this pull request Nov 11, 2024
tomasnorre added a commit to tomasnorre/exercism-php that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/improve Improve existing functionality/content x:knowledge/elementary Little Exercism knowledge required x:rep/small Small amount of reputation x:size/small Small amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants