I am using Laravel 5.3 and unfortunately when you run gulp tdd
, a change to 1 file runs the entire test suite which now takes nearly 2 minutes. With reference to this post, I started using Grunt to run specific tests when specific files are changed. Sample Gruntfile below:
Gruntfile.js:
var phpunit = 'vendor/bin/phpunit ';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
HomeSrc: {
files: [
'app/Http/**/HomeController.php',
'resources/views/home/**/*.php'
],
tasks: ['HomeTests']
},
shell: {
HomeTests: { command: phpunit + 'tests/Home' },
}
});
However, now my Gruntfile is getting pretty long and I would like to run specific test files when they are changed.
Questions
- Is there a more efficient way to do this? (better organization of the Grunfile or using Gulp instead)
- How can I run a specific test when its file is changed?
Example:
When tests/Home/IndexTest.php
is changed, automatically run vendor/bin/phpunit tests/Home/IndexTest.php