Download the PHP package cnimmo/test-only-changed without Composer
On this page you can find all versions of the php package cnimmo/test-only-changed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cnimmo/test-only-changed
More information about cnimmo/test-only-changed
Files in cnimmo/test-only-changed
Package test-only-changed
Short Description Run Paratest on only changed files
License MIT
Informations about the package test-only-changed
Stop wasting time running tests that you know aren't failing!
This Github action allows you to execute your PHP unit tests more quickly in CI, by running only tests which are related to files changed since the last successful workflow run.
In other words, we only run the tests which may actually be failing.
This package is inspired by the --onlyChanged flag in Jest.
We use Paratest as the test runner for blazingly fast parallel execution.
Prerequisites
The action should be used in a Github actions workflow with PHP and composer already set up.
Usage
See an example workflow.
Supported arguments:
branch-name
Name of branch to scan for last successful workflow run. Defaults to current branch.workflow-id
Name of workflow to check for success. Defaults to current workflow.tests-directory
The directory where the tests are located relative to the root. Defaults to tests.ignore-paths
Files to ignore when determining which files to run. Defaults tovendor,node_modules,_ide_helper.php
list-only
This option allows the flexibility to configure Paratest/bring your own test runner. When set to true, the action will not run your tests, but instead write a list of all testsuites to thefiles
output, joined by theseparator
(see below).separator
To be used alongside thelist-only
argument. Specifies the separator that should be used between each testsuite name. Defaults to a comma.
How it works
The package builds a dependency graph for each of your test files, and then compares this to the files changed since your tests last passed successfully.
If the dependency graph includes the file being checked, the file is included in the test run.
We then generate a phpunit.xml
on the fly, based on your existing phpunit.xml
, with a testsuite specified for each of the relevant test files, as Paratest doesn't support running specific files within a larger test suite.
Caveats
- Currently only supports PHP namespaces via "use" imports. Dynamic imports are not detected.