-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prefer lockfile detection over env var one
- Loading branch information
1 parent
4d33c64
commit 9f414fb
Showing
2 changed files
with
20 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -503,6 +503,25 @@ describe("install", () => { | |
); | ||
}); | ||
|
||
it("prefer lockfile detection over env detection", async () => { | ||
await runInTempDir(async (tmp) => { | ||
await writeJson<PkgJson>(path.join(tmp, "package.json"), { | ||
name: "foo", | ||
version: "0.0.1", | ||
dependencies: { | ||
preact: "10.23.2", | ||
}, | ||
}); | ||
|
||
await exec("pnpm", ["install"], tmp); | ||
await runJsr(["i", "@std/[email protected]"], tmp, { | ||
npm_config_user_agent: | ||
`npm/10.8.2 node/v22.5.1 darwin arm64 workspaces/false`, | ||
}); | ||
assert.ok(!fs.existsSync(path.join(tmp, "package-lock.json"))); | ||
}); | ||
}); | ||
|
||
it("overwrite detection with arg from npm_config_user_agent", async () => { | ||
await withTempEnv( | ||
["i", "--npm", "@std/[email protected]"], | ||
|