A phpunit runner for Jest
npm install jest-runner-phpunit


Install jest_(it needs Jest 21+)_ and jest-runner-phpunit
``bashjest-runner-phpunit assumes phpunit is installed with composer
composer require --dev phpunit/phpunit
npm install --save-dev jest jest-runner-phpunit
`
#### Standalone
In your package.json`json`
{
"jest": {
"runner": "jest-runner-phpunit",
"displayName": "phpunit",
"moduleFileExtensions": ["php"],
"testMatch": ["
}
}
Or in jest.config.js`js`
module.exports = {
runner: 'jest-runner-phpunit',
"displayName": "phpunit",
"moduleFileExtensions": ["php"],
testMatch: ['
}
Please update testMatch to match your project folder structure
#### Alongside other runners
It is recommended to use the projects configuration option to run multiple Jest runners simultaneously.
If you are using Jest <22.0.5, you can use multiple Jest configuration files and supply the paths to those files in the projects option. For example:
`js
// jest-test.config.js
module.exports = {
// your Jest test options
displayName: 'test'
}
// jest-phpunit.config.js
module.exports = {
// your jest-runner-phpunit options
runner: 'jest-runner-phpunit',
displayName: "phpunit",
moduleFileExtensions: ["php"],
testMatch: ['
}
`
In your package.json:
`json`
{
"jest": {
"projects": [
"
"
]
}
}
Or in jest.config.js:
`js`
module.exports = {
projects: [
'
'
]
}
If you are using Jest >=22.0.5, you can supply an array of project configuration objects instead. In your package.json:
`json`
{
"jest": {
"projects": [
{
"displayName": "test"
},
{
"runner": "jest-runner-phpunit",
"displayName": "phpunit",
"moduleFileExtensions": ["php"],
"testMatch": ["
}
]
}
}
Or in jest.config.js:
`js`
module.exports = {
projects: [
{
displayName: 'test'
},
{
runner: 'jest-runner-phpunit',
displayName: "phpunit",
moduleFileExtensions: ["php"],
testMatch: ['
}
]
}
bash
yarn jest
``