-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a9ae0b
commit 1d7fea1
Showing
1 changed file
with
60 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,32 +377,36 @@ describe("install", () => { | |
); | ||
}); | ||
|
||
it("jsr add --yarn @std/[email protected] - forces yarn", async () => { | ||
await withTempEnv( | ||
["i", "--yarn", "@std/[email protected]"], | ||
async (dir) => { | ||
// Running this scenario directly under windows works, but for | ||
// some reason it fails in tests. Not sure why. | ||
if (process.platform !== "win32") { | ||
it("jsr add --yarn @std/[email protected] - forces yarn", async () => { | ||
await withTempEnv( | ||
["i", "--yarn", "@std/[email protected]"], | ||
async (dir) => { | ||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
}, | ||
); | ||
|
||
await runInTempDir(async (dir) => { | ||
await enableYarnBerry(dir); | ||
|
||
await runJsr(["i", "--yarn", "@std/[email protected]"], dir); | ||
|
||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
}, | ||
); | ||
|
||
await runInTempDir(async (dir) => { | ||
await enableYarnBerry(dir); | ||
|
||
await runJsr(["i", "--yarn", "@std/[email protected]"], dir); | ||
|
||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
assert.ok( | ||
await isFile(path.join(dir, ".yarnrc.yml")), | ||
"yarnrc file not created", | ||
); | ||
assert.ok( | ||
await isFile(path.join(dir, ".yarnrc.yml")), | ||
"yarnrc file not created", | ||
); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
it("jsr add --pnpm @std/[email protected] - forces pnpm", async () => { | ||
await withTempEnv( | ||
|
@@ -480,7 +484,7 @@ describe("install", () => { | |
); | ||
}); | ||
|
||
it("overwrite detection with arg from npm_config_user_agent", async () => { | ||
it.only("overwrite detection with arg from npm_config_user_agent", async () => { | ||
await withTempEnv( | ||
["i", "--npm", "@std/[email protected]"], | ||
async (dir) => { | ||
|
@@ -499,42 +503,46 @@ describe("install", () => { | |
); | ||
}); | ||
|
||
it("detect yarn from npm_config_user_agent", async () => { | ||
await withTempEnv( | ||
["i", "@std/[email protected]"], | ||
async (dir) => { | ||
// Running this scenario directly under windows works, but for | ||
// some reason it fails in tests. Not sure why. | ||
if (process.platform !== "win32") { | ||
it("detect yarn from npm_config_user_agent", async () => { | ||
await withTempEnv( | ||
["i", "@std/[email protected]"], | ||
async (dir) => { | ||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
}, | ||
{ | ||
env: { | ||
...process.env, | ||
npm_config_user_agent: | ||
`yarn/1.22.19 ${process.env.npm_config_user_agent}`, | ||
}, | ||
}, | ||
); | ||
|
||
await runInTempDir(async (dir) => { | ||
await enableYarnBerry(dir); | ||
|
||
await runJsr(["i", "@std/[email protected]"], dir, { | ||
npm_config_user_agent: | ||
`yarn/4.1.0 ${process.env.npm_config_user_agent}`, | ||
}); | ||
|
||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
}, | ||
{ | ||
env: { | ||
...process.env, | ||
npm_config_user_agent: | ||
`yarn/1.22.19 ${process.env.npm_config_user_agent}`, | ||
}, | ||
}, | ||
); | ||
|
||
await runInTempDir(async (dir) => { | ||
await enableYarnBerry(dir); | ||
|
||
await runJsr(["i", "@std/[email protected]"], dir, { | ||
npm_config_user_agent: | ||
`yarn/4.1.0 ${process.env.npm_config_user_agent}`, | ||
assert.ok( | ||
await isFile(path.join(dir, ".yarnrc.yml")), | ||
"yarnrc file not created", | ||
); | ||
}); | ||
|
||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created", | ||
); | ||
assert.ok( | ||
await isFile(path.join(dir, ".yarnrc.yml")), | ||
"yarnrc file not created", | ||
); | ||
}); | ||
}); | ||
} | ||
|
||
if (process.platform !== "win32") { | ||
it("detect bun from npm_config_user_agent", async () => { | ||
|