Run your test suite locally against your travis build matrix with grunt-test-matrix.

I'm really excited to have this completed finally. This is a project I've been thinking about for some time because there's not really a good alternative out there. There is one other project I've seen that does this, but it requires docker. This one doesn't. To me, that's a plus. No container set up.

So what is this? It's a grunt plugin that wraps the n-run module, also written by me (really, writing that, and several of its dependencies, was part of this project, since making this functionality more broadly consumable than solely via grunt task seemed like a good idea). n-run is a module that uses n to run commands against multiple node binaries. Let that soak in. Yes, it really does that. This grunt plugin, specifically, will run a grunt task against your travis build matrix, so you no longer have to push your changes up to travis to see if it's passing in every version. You don't need to switch manually between versions and run tests. Now, you just do this:


// load other stuff

  testMatrix: {
    mocha: {
      task: 'mocha'


language: node_js  
# Other stuff
  - 0.10
  - 0.12
  - iojs-v1
  - iojs-v2
  - iojs-v3
  - 4
  - 5

Now when you run grunt testMatrix or grunt testMatrix:mocha, your mocha test suite (assuming you have another task called "mocha") will be run against the latest 0.10, 0.12, 4, and 5 node binaries, as well as io.js versions 1, 2, and 3.

Here's a demo of grunt-test-matrix running it's own mocha tests against its build matrix:


By default, grunt-test-matrix will install the latest version of node/io matching the ranges in your travis.yml, even if another installed version satisfies the range. You can set the option install to true to install only missing versions or to false to skip missing versions. You can also suppress logging with quiet: true, use a local copy of grunt with global: false, or override which versions the task is run against by setting versions to an array of versions or semver ranges.