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

Enable custom categories or groups for tests #357

Open
Chemaclass opened this issue Oct 8, 2024 · 0 comments
Open

Enable custom categories or groups for tests #357

Chemaclass opened this issue Oct 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Chemaclass
Copy link
Member

Right now you can group tests only by folders or name. This task is to research best practices in other testing libraries and how could we achieve categorising tests as "slow" or something different.


Examples using different testing libraries:

PHPUnit

/** @group slow */
public function test_something_slow(): void
{
    // slow test code here
}
# Run only the slow tests
phpunit --group slow

# Exclude slow tests
phpunit --exclude-group slow

Pest

it('is a slow test')->group('slow', function () {
    // slow test code here
});
# Run only slow tests
./vendor/bin/pest --group=slow

# Exclude slow tests
./vendor/bin/pest --exclude-group=slow

Jest

// Mark the test with "slow" in the name
test('slow: this is a slow test', () => {
  // slow test code here
});

You can then filter tests based on the test name when running Jest using --testNamePattern:

# Run only slow tests
jest --testNamePattern="slow"

# Exclude slow tests (by excluding the "slow" pattern)
jest --testNamePattern="^((?!slow).)*$"

I think the best approach for bashunit is going into something similar like jest 🤔

@Chemaclass Chemaclass added the enhancement New feature or request label Oct 8, 2024
@Chemaclass Chemaclass moved this to Todo in bashunit Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant