Skip to content

Commit

Permalink
fix(run-lifecycle): Do not customize npm_config_prefix during execution
Browse files Browse the repository at this point in the history
Fixes #1866
  • Loading branch information
evocateur committed Jan 11, 2019
1 parent d9ac62c commit 79549c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
15 changes: 8 additions & 7 deletions utils/run-lifecycle/__tests__/run-lifecycle.test.js
Expand Up @@ -2,6 +2,7 @@

jest.mock("libnpm/run-script", () => jest.fn(() => Promise.resolve()));

const log = require("libnpm/log");
const loggingOutput = require("@lerna-test/logging-output");
const runScript = require("libnpm/run-script");
const npmConf = require("@lerna/npm-conf");
Expand Down Expand Up @@ -64,7 +65,6 @@ describe("runLifecycle()", () => {
pkg.location,
expect.objectContaining({
config: expect.objectContaining({
prefix: pkg.location,
"custom-cli-flag": true,
}),
dir: pkg.location,
Expand All @@ -89,8 +89,8 @@ describe("runLifecycle()", () => {
const opts = new Map([
["ignore-prepublish", true],
["ignore-scripts", false],
["node-options", true],
["script-shell", true],
["node-options", "--a-thing"],
["script-shell", "fish"],
["scripts-prepend-node-path", true],
["unsafe-perm", false],
]);
Expand All @@ -99,13 +99,14 @@ describe("runLifecycle()", () => {

expect(runScript).toHaveBeenLastCalledWith(expect.objectContaining(pkg), stage, dir, {
config: expect.objectContaining({
prefix: dir,
"node-options": "--a-thing",
"script-shell": "fish",
}),
dir,
failOk: false,
log: expect.any(Object),
nodeOptions: true,
scriptShell: true,
log,
nodeOptions: "--a-thing",
scriptShell: "fish",
scriptsPrependNodePath: true,
unsafePerm: false,
});
Expand Down
3 changes: 0 additions & 3 deletions utils/run-lifecycle/run-lifecycle.js
Expand Up @@ -74,9 +74,6 @@ function runLifecycle(pkg, stage, _opts) {
}
}

// env.npm_config_prefix should be the package directory
config.prefix = dir;

/* istanbul ignore else */
// eslint-disable-next-line no-underscore-dangle
if (pkg.__isLernaPackage) {
Expand Down

0 comments on commit 79549c1

Please sign in to comment.