This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: Fix path used to run the install relative to
Previously I was using the path of the module to be updated. But no, silly, we want the path that CONTAINS it. PR-URL: #9303 Fixes: #9095
- Loading branch information
Showing
2 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict' | ||
var test = require('tap').test | ||
var requireInject = require('require-inject') | ||
|
||
var mockNpm = { | ||
config: { | ||
get: function (key) { | ||
return false | ||
} | ||
}, | ||
commands: { | ||
outdated: function (args, silent, cb) { | ||
cb(null, [ | ||
[{path: '/incorrect', parent: {path: '/correct'}}, 'abc', '1.0.0', '1.1.0', '1.1.0', '^1.1.0'] | ||
]) | ||
} | ||
} | ||
} | ||
|
||
// What we're testing here is that updates use the parent module's path to | ||
// install from. | ||
test('update', function (t) { | ||
var update = requireInject('../../lib/update.js', { | ||
'../../lib/npm.js': mockNpm, | ||
'../../lib/install.js': { | ||
'Installer': function (where, dryrun, args) { | ||
t.is(where, '/correct', 'We should be installing to the parent of the modules being updated') | ||
this.run = function (cb) { cb() } | ||
} | ||
} | ||
}) | ||
update(['abc'], function () { | ||
t.end() | ||
}) | ||
}) |