Skip to content

Commit

Permalink
ignore win
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed May 27, 2024
1 parent 4a9ae0b commit 1d7fea1
Showing 1 changed file with 60 additions and 52 deletions.
112 changes: 60 additions & 52 deletions test/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 1d7fea1

Please sign in to comment.