mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 18:27:23 +01:00
feat: skips on windows
This commit is contained in:
@ -172,6 +172,17 @@ final class TestCall
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the current test if the given test is running on Windows.
|
||||||
|
*/
|
||||||
|
public function skipOnWindows(): self
|
||||||
|
{
|
||||||
|
return $this->skip(
|
||||||
|
PHP_OS_FAMILY === 'Windows',
|
||||||
|
'This test is skipped on Windows.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the test as "todo".
|
* Sets the test as "todo".
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -39,4 +39,4 @@ test('collision', function (array $arguments) {
|
|||||||
})->with([
|
})->with([
|
||||||
[['']],
|
[['']],
|
||||||
[['--parallel']],
|
[['--parallel']],
|
||||||
])->skip(PHP_OS_FAMILY === 'Windows');
|
])->skipOnWindows();
|
||||||
|
|||||||
@ -18,4 +18,4 @@ test('visual snapshot of help command output', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect($output())->toContain(file_get_contents($snapshot));
|
expect($output())->toContain(file_get_contents($snapshot));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|||||||
@ -20,7 +20,7 @@ test('parallel', function () use ($run) {
|
|||||||
expect($run('--exclude-group=integration'))
|
expect($run('--exclude-group=integration'))
|
||||||
->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 697 passed (1696 assertions)')
|
->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 697 passed (1696 assertions)')
|
||||||
->toContain('Parallel: 3 processes');
|
->toContain('Parallel: 3 processes');
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|
||||||
test('a parallel test can extend another test with same name', function () use ($run) {
|
test('a parallel test can extend another test with same name', function () use ($run) {
|
||||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 2 passed (2 assertions)');
|
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 2 passed (2 assertions)');
|
||||||
|
|||||||
@ -24,11 +24,11 @@ $snapshot = function ($name) {
|
|||||||
|
|
||||||
test('allows to run a single test', function () use ($run, $snapshot) {
|
test('allows to run a single test', function () use ($run, $snapshot) {
|
||||||
expect($run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'))->toContain($snapshot('allows-to-run-a-single-test'));
|
expect($run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'))->toContain($snapshot('allows-to-run-a-single-test'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|
||||||
test('allows to run a directory', function () use ($run, $snapshot) {
|
test('allows to run a directory', function () use ($run, $snapshot) {
|
||||||
expect($run('tests/Fixtures'))->toContain($snapshot('allows-to-run-a-directory'));
|
expect($run('tests/Fixtures'))->toContain($snapshot('allows-to-run-a-directory'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|
||||||
it('disable decorating printer when colors is set to never', function () use ($snapshot) {
|
it('disable decorating printer when colors is set to never', function () use ($snapshot) {
|
||||||
$process = new Process([
|
$process = new Process([
|
||||||
@ -40,4 +40,4 @@ it('disable decorating printer when colors is set to never', function () use ($s
|
|||||||
$process->run();
|
$process->run();
|
||||||
$output = $process->getOutput();
|
$output = $process->getOutput();
|
||||||
expect($output)->toContain($snapshot('disable-decorating-printer'));
|
expect($output)->toContain($snapshot('disable-decorating-printer'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|||||||
@ -41,4 +41,4 @@ test('visual snapshot of test suite on success', function () {
|
|||||||
expect(implode("\n", $output))->toContain(file_get_contents($snapshot));
|
expect(implode("\n", $output))->toContain(file_get_contents($snapshot));
|
||||||
}
|
}
|
||||||
})->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
|
})->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
|
||||||
->skip(PHP_OS_FAMILY === 'Windows');
|
->skipOnWindows();
|
||||||
|
|||||||
@ -26,8 +26,8 @@ $snapshot = function ($name) {
|
|||||||
|
|
||||||
test('todo', function () use ($run, $snapshot) {
|
test('todo', function () use ($run, $snapshot) {
|
||||||
expect($run('--todos', false))->toContain($snapshot('todo'));
|
expect($run('--todos', false))->toContain($snapshot('todo'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|
||||||
test('todo in parallel', function () use ($run, $snapshot) {
|
test('todo in parallel', function () use ($run, $snapshot) {
|
||||||
expect($run('--todos', true))->toContain($snapshot('todo'));
|
expect($run('--todos', true))->toContain($snapshot('todo'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|||||||
@ -18,4 +18,4 @@ test('visual snapshot of help command output', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect($output())->toContain(file_get_contents($snapshot));
|
expect($output())->toContain(file_get_contents($snapshot));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skipOnWindows();
|
||||||
|
|||||||
Reference in New Issue
Block a user