npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-phpunit-runner

v0.1.9

Published

A phpunit runner that works

Downloads

104

Readme

grunt-phpunit-runner

A phpunit runner that works

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-phpunit-runner --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-phpunit-runner');

The "phpunit-runner" task

Overview

In your project's Gruntfile, add a section named phpunit-runner to the data object passed into grunt.initConfig().

grunt.initConfig({
  'phpunit-runner': {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    }
  }
});

Phpunit currently doesn't support individual files to deal with. grunt-phpunit-runner bridges that gap... sort of.

Test files

Specifying a test folder

grunt.initConfig({
  'phpunit-runner': {
    all: {
      options: {
        phpunit: 'vendor/bin/phpunit'
      },
      testFolder: 'tests/'
    }
  }
});
Specifying multiple folders

You can specify multiple folders. That will result in running phpunit as many times as number of folders you have.

grunt.initConfig({
  'phpunit-runner': {
    all: {
      options: {
        phpunit: 'vendor/bin/phpunit'
      },
      testFolder1: 'tests1/',
      testFolder2: 'tests2/'
    }
  }
});

Specifying unittests

grunt.initConfig({
  'phpunit-runner': {
    all: {
      options: {
        phpunit: 'vendor/bin/phpunit'
      },
      testName: 'tests/testName.php'
    }
  }
});

Again, you can specify as many as you'd like

Options

The options more or less mimic phpunit's configuration parameters.

There are 2 special cases however, the options.extraParameters and the options.phpIni

options.extraParameters

Type: Array

If you want to pass through something that phpunut-runner doesn't support Whatever you'd add in the command line, like:

extraParameters: [
  '--a-new-option',
  '--another-option'
]

options.phpIni

Type: Object

For phpunit's -d flag.

phpIni: {
  'parameter':'value',
  'flag': ''
}

will translate to -d parameter=value -d flag

options.coverageClover

Type: string

The equivalent of phpunit's --coverage-clover option

options.coverageCrap4j

Type: string

The equivalent of phpunit's --coverage-crap4j option

options.coverageHtml

Type: string

The equivalent of phpunit's --coverage-html option

options.coveragePhp

Type: string

The equivalent of phpunit's --coverage-php option

options.coverageText

Type: string

The equivalent of phpunit's --coverage-text option

options.coverageXml

Type: string

The equivalent of phpunit's --coverage-xml option

options.logJunit

Type: string

The equivalent of phpunit's --log-junit option

options.logTap

Type: string

The equivalent of phpunit's --log-tap option

options.logJson

Type: string

The equivalent of phpunit's --log-json option

options.testdoxHtml

Type: string

The equivalent of phpunit's --testdox-html option

options.testdoxText

Type: string

The equivalent of phpunit's --testdox-text option

options.configuration

Type: string

The equivalent of phpunit's --configuration option

options.bootstrap

Type: string

The equivalent of phpunit's --bootstrap option

options.filter

Type: string

The equivalent of phpunit's --filter option

options.testsuite

Type: string

The equivalent of phpunit's --testsuite option

options.group

Type: string

The equivalent of phpunit's --group option

options.excludeGroup

Type: string

The equivalent of phpunit's --exclude-group option

options.listGroups

Type: boolean

The equivalent of phpunit's --list-groups option

options.testSuffix

Type: string

The equivalent of phpunit's --test-suffix option

options.reportUselessTests

Type: boolean

The equivalent of phpunit's --report-useless-tests option

options.strictCoverage

Type: boolean

The equivalent of phpunit's --strict-coverage option

options.strictGlobalState

Type: boolean

The equivalent of phpunit's --strict-global-state option

options.disallowTestOutput

Type: boolean

The equivalent of phpunit's --disallow-test-output option

options.enforecTimeLimit

Type: boolean

The equivalent of phpunit's --enforce-time-limit option

options.disallowTodoTests

Type: boolean

The equivalent of phpunit's --disallow-todo-tests option

options.processIsolation

Type: boolean

The equivalent of phpunit's --process-isolation option

options.noGlobalsBackup

Type: boolean

The equivalent of phpunit's --no-globals-backup option

options.staticBackup

Type: boolean

The equivalent of phpunit's --static-backup option

options.columns

Type: string

The equivalent of phpunit's --columns option

options.stderr

Type: boolean

The equivalent of phpunit's --stderr option

options.stopOnError

Type: boolean

The equivalent of phpunit's --stop-on-error option

options.stopOnFailure

Type: boolean

The equivalent of phpunit's --stop-on-failure option

options.stopOnRisky

Type: boolean

The equivalent of phpunit's --stop-on-risky option

options.stopOnSkipped

Type: boolean

The equivalent of phpunit's --stop-on-skipped option

options.stopOnIncomplete

Type: boolean

The equivalent of phpunit's --stop-on-incomplete option

options.verbose

Type: boolean

The equivalent of phpunit's --verbose option

options.debug

Type: boolean

The equivalent of phpunit's --debug option

options.loader

Type: string

The equivalent of phpunit's --loader option

options.repeat

Type: string

The equivalent of phpunit's --repeat option

options.tap

Type: boolean

The equivalent of phpunit's --tap option

options.testdox

Type: boolean

The equivalent of phpunit's --testdox option

options.printer

Type: string

The equivalent of phpunit's --printer option

options.noConfiguration

Type: boolean

The equivalent of phpunit's --no-configuration option

options.includePath

Type: string

The equivalent of phpunit's --include-path option

options.version

Type: boolean

The equivalent of phpunit's --version option

Usage Examples

Good Options

An example how to generate test and coverage reports

grunt.initConfig({
  'phpunit-runner': {
    complete: {
      options: {
        phpunit: 'vendor/bin/phpunit',
        logJunit: 'reports/unit.xml',
        coverageClover: 'reports/coverage.xml',
        colors: true
      },
      files: {
            testFiles: 'tests/'
          }
      }
    }
  }
});

Fast Options

This is a config that runs very fast, and could be used in a watch config for example

grunt.initConfig({
  'phpunit-runner': {
    fast: {
      options: {
        phpunit: 'vendor/bin/phpunit',
        colors: true
      },
      files: {
            testFiles: 'tests/'
          }
      }
    }
  }
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 0.1.9 - properly calling error callback
  • 0.1.8 - fixed properly quitting on error, and suppressed double error logging
  • 0.1.7 - proper config in readme
  • 0.1.6 - cleaning up versions and travis
  • 0.1.5 - readme fixup
  • 0.1.4 - readme fixup
  • 0.1.3 - working targets
  • 0.1.0 - basic functionality