VitestTestRunner
final class VitestTestRunner extends TestRunner
Supports Vitest unit testing operations.
Constants
| ALLOWED_OPTIONS |
The array of options allowed as input for the test command. |
| COMPONENT_PATH |
Path for component tests. |
| REACT_TEST_FILE_EXTENSION |
File extension for component and view tests. |
| VIEW_PATH |
Path for view tests. |
| TEST_COMMAND |
The command for Vitest |
| UNIT_PATH |
Path for unit tests. |
| UNIT_TEST_FILE_EXTENSION |
File extension for Vitest unit tests. |
Properties
| protected string | $inputOptions | A string of input options provided as input when running the test command. |
from TestRunner |
| protected OutputInterface | $output | The Symfony OutputInterface object. |
from TestRunner |
Methods
Constructor
Test to ensure there is not an empty test suite.
Performs all available tests.
Present message to the user if the following conditions are true:
- Test case files in multiple suites with the same name
- There exists a function in both classes with the same name
Retrieves all files in test suite so they can be run.
Alerts use if there are no available tests to perform.
Runs the unit test for your testing suite.
Supports ability to run test by class/file name.
Performs testing against a single class within a test suite.
Determine if test file exists in any of the available test suites.
Enforces rule that classes/files across test suites should be unique for filtering.
Run all test files in an individual test suite.
Determines if execution of a test suite(s) is successful. The result is determined by testing if the status value is set and its integer value is equal to Command::SUCCESS.
Ensure filter syntax is correct. Does not test if only one : is in string.
Parses Vitest related arguments and ignore Symfony arguments.
Run filtered test by line number.
Details
at line 62
__construct(InputInterface $input, OutputInterface $output)
Constructor
in
TestRunner at line 51
bool
areAllSuitesEmpty(array $testSuites)
Test to ensure there is not an empty test suite.
in
TestRunner at line 67
int
allTests(array $testSuites, string|array $extensions, string $testCommand)
Performs all available tests.
in
TestRunner at line 107
static private void
duplicateTestNameMessage()
Present message to the user if the following conditions are true:
- Test case files in multiple suites with the same name
- There exists a function in both classes with the same name
This function is called internally by the selectTest function.
in
TestRunner at line 121
static array
getAllTestsInSuite(string $path, string $ext)
Retrieves all files in test suite so they can be run.
in
TestRunner at line 130
private void
noAvailableTestsMessage()
Alerts use if there are no available tests to perform.
in
TestRunner at line 141
void
runTest(string $test, string $testCommand)
Runs the unit test for your testing suite.
in
TestRunner at line 158
int
selectByTestName(string $testArg, array $testSuites, string|array $extensions, string $testCommand)
Supports ability to run test by class/file name.
in
TestRunner at line 204
int
singleFileWithinSuite(string $testArg, string $testSuite, string $ext, string $command)
Performs testing against a single class within a test suite.
in
TestRunner at line 223
static bool
testExists(string $name, array $testSuites, string|array $extensions)
Determine if test file exists in any of the available test suites.
in
TestRunner at line 252
static bool
testIfSame(string $name, array $testSuites, string|array $extension)
Enforces rule that classes/files across test suites should be unique for filtering.
in
TestRunner at line 283
int
testSuite(array $collection, string $testCommand)
Run all test files in an individual test suite.
in
TestRunner at line 305
static bool
testSuiteStatus(array $suiteStatuses)
Determines if execution of a test suite(s) is successful. The result is determined by testing if the status value is set and its integer value is equal to Command::SUCCESS.
in
TestRunner at line 318
static bool
verifyFilterSyntax(string $testArg)
Ensure filter syntax is correct. Does not test if only one : is in string.
at line 74
static string
parseOptions(InputInterface $input)
Parses Vitest related arguments and ignore Symfony arguments.
at line 115
int
testByFilter(string $testArg, array $testSuites, array $extensions)
Run filtered test by line number.