Skip to content

Commit

Permalink
feat: Allow --todo argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiCO2k committed Nov 30, 2023
1 parent 90fb8c6 commit ac5da9e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/pest
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
unset($args[$key]);
}

if ($value === '--todos') {
if (str_contains($value, '--todo')) {
$todo = true;
unset($args[$key]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Parallel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class Parallel implements HandlesArguments
/**
* @var string[]
*/
private const UNSUPPORTED_ARGUMENTS = ['--todos', '--retry'];
private const UNSUPPORTED_ARGUMENTS = ['--todo', '--todos', '--retry'];

/**
* Whether the given command line arguments indicate that the test suite should be run in parallel.
Expand Down
4 changes: 3 additions & 1 deletion tests/.snapshots/success.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,12 @@
- visual snapshot of team city with ('SuccessOnly.php')

PASS Tests\Visual\Todo
✓ todos
✓ todos in parallel
✓ todo
✓ todo in parallel

WARN Tests\Visual\Version
- visual snapshot of help command output

Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 964 passed (2282 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 966 passed (2286 assertions)
31 changes: 31 additions & 0 deletions tests/.snapshots/todos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
TODO Tests\Features\BeforeEachProxiesToTestCallWithTodo - 4 todos
↓ is marked as todo 1
↓ is marked as todo 2
↓ is marked as todo 3
↓ shouldBeMarkedAsTodo

TODO Tests\Features\DatasetsTests - 1 todo
↓ forbids to define tests in Datasets dirs and Datasets.php files

TODO Tests\Features\Describe - 5 todos
↓ todo
↓ todo on hook → should not fail
↓ todo on hook → should run
↓ todo on describe → should not fail
↓ todo on describe → should run

TODO Tests\Features\Todo - 3 todos
↓ something todo later
↓ something todo later chained
↓ something todo later chained and with function body

PASS Tests\CustomTestCase\ChildTest
✓ override method

PASS Tests\CustomTestCase\ExecutedTest
✓ that gets executed

PASS Tests\CustomTestCase\ParentTest
✓ override method

Tests: 13 todos, 3 passed (3 assertions)
12 changes: 10 additions & 2 deletions tests/Visual/Todo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@
]));
};

test('todos', function () use ($run, $snapshot) {
expect($run('--todos', false))->toContain($snapshot('todos'));
})->skipOnWindows();

test('todos in parallel', function () use ($run, $snapshot) {
expect($run('--todos', true))->toContain($snapshot('todos'));
})->skipOnWindows();

test('todo', function () use ($run, $snapshot) {
expect($run('--todos', false))->toContain($snapshot('todo'));
expect($run('--todo', false))->toContain($snapshot('todo'));
})->skipOnWindows();

test('todo in parallel', function () use ($run, $snapshot) {
expect($run('--todos', true))->toContain($snapshot('todo'));
expect($run('--todo', true))->toContain($snapshot('todo'));
})->skipOnWindows();

0 comments on commit ac5da9e

Please sign in to comment.