diff --git a/lib/index.js b/lib/index.js index 3381ba8..798b0c9 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,6 +4,7 @@ const path = require('path') const assert = require('assert') module.exports = function (cwd, group) { + group = group || 'prod' let pkg = {} // exit early @@ -17,7 +18,7 @@ module.exports = function (cwd, group) { } // set suffix - group = group + 'Dependencies' + group = ~['prod', 'production'].indexOf(group) ? 'dependencies' : group + 'Dependencies' // exit early assert(pkg[group], 'no matching dependencies') diff --git a/test/fixture/package.json b/test/fixture/package.json index f8d4702..c9b7010 100644 --- a/test/fixture/package.json +++ b/test/fixture/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "abc": "1.2" + "abc": "1.2.3" }, "devDependencies": { diff --git a/test/index.js b/test/index.js index bbde98e..730f552 100644 --- a/test/index.js +++ b/test/index.js @@ -27,3 +27,11 @@ tap.test('should return an empty result', (assert) => { assert.same(packages, []) }) + +tap.test('should allow for "prod" install', (assert) => { + assert.plan(1) + + const packages = list(fixture, 'prod') + + assert.same(packages, ['abc@1.2.3']) +})