Skip to content

Commit 58b8f3c

Browse files
authored
Merge pull request #1598 from Willem-Jaap/willem-jaap/pest-only-file-level
feat: add pest only function to mark each test in a file as only
2 parents 1701a30 + c157b66 commit 58b8f3c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Configuration.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Pest;
66

7+
use Pest\PendingCalls\BeforeEachCall;
78
use Pest\PendingCalls\UsesCall;
89

910
/**
@@ -62,6 +63,14 @@ public function group(string ...$groups): UsesCall
6263
return (new UsesCall($this->filename, []))->group(...$groups);
6364
}
6465

66+
/**
67+
* Marks all tests in the current file to be run exclusively.
68+
*/
69+
public function only(): void
70+
{
71+
(new BeforeEachCall(TestSuite::getInstance(), $this->filename))->only();
72+
}
73+
6574
/**
6675
* Depending on where is called, it will extend the given classes and traits globally or locally.
6776
*/

0 commit comments

Comments
 (0)