From 2d54fd7696c11168b539c7ffac6c1396cb367530 Mon Sep 17 00:00:00 2001 From: Patrick Kettner Date: Thu, 14 Jan 2016 19:19:22 -0800 Subject: [PATCH] fix cli crash introduced in #1830 --- bin/modernizr | 2 +- test/node/lib/cli.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/modernizr b/bin/modernizr index 97e3e13f97..8634692a48 100755 --- a/bin/modernizr +++ b/bin/modernizr @@ -119,7 +119,7 @@ if (argv.o || argv.f) { .replace(/-/g, ',') .split(',') .map(function(prop) { - var obj = _.findWhere(source, {property: prop}); + var obj = _.find(source, {property: prop}); if (_.isUndefined(obj)) { throw new Error('invalid key value name - ' + prop); diff --git a/test/node/lib/cli.js b/test/node/lib/cli.js index 902ad47702..cea4636737 100644 --- a/test/node/lib/cli.js +++ b/test/node/lib/cli.js @@ -1,5 +1,6 @@ var root = require('find-parent-dir').sync(__dirname, 'package.json'); var expect = require('expect.js'); +var cp = require('child_process'); var Modernizr = require(root + 'lib/cli'); @@ -13,4 +14,8 @@ describe('cli', function() { expect(Modernizr.metadata).to.be.a('function'); }); + it('does not throw when being executed', function(done) { + cp.exec('node ' + root + '/bin/modernizr -f adownload', done); + }); + });