mercredi 18 janvier 2017

How to automatically run a single phpunit test when it is updated?

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

  1. Is there a more efficient way to do this? (better organization of the Grunfile or using Gulp instead)
  2. 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



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jAlZPD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire