diff --git a/tools/stats.js b/tools/stats.js index aeb19e6ad4..c0626ca303 100644 --- a/tools/stats.js +++ b/tools/stats.js @@ -48,7 +48,7 @@ var packageList = function (_currentProjectForTest) { return { name: name, version: version, - direct: _.contains(directDeps, name) + direct: _.has(directDeps, name) }; } ); diff --git a/tools/tests/report-stats.js b/tools/tests/report-stats.js index e70aacd193..0edc6222d6 100644 --- a/tools/tests/report-stats.js +++ b/tools/tests/report-stats.js @@ -73,6 +73,14 @@ selftest.define("report-stats", ["slow"], function () { selftest.expectEqual(_.sortBy(usage.packages, "name"), _.sortBy(stats.packageList(sandboxProject), "name")); + // Check that the direct dependency was recorded as such. + _.each(usage.packages, function (package) { + if (package.name === "local-package" && + ! package.direct) { + selftest.fail("local-package is not marked as a direct dependency"); + } + }); + // verify that the stats server recorded that with no userId var appPackages = stats.getPackagesForAppIdInTest(sandboxProject); selftest.expectEqual(appPackages.appId, identifier);