Skip to content

Commit

Permalink
move bun-win filter to shared
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 29, 2023
1 parent 6bd71aa commit 61928fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
19 changes: 14 additions & 5 deletions test/_shared.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fileURLToPath } from "node:url";
import { isWindows } from "std-env";
import type { PackageManagerName } from "../src";

export type Fixture = {
Expand Down Expand Up @@ -54,11 +55,19 @@ export const fixtures = (
majorVersion: "3",
},
] satisfies Partial<Fixture>[]
).map((fixture) => ({
...fixture,
dir: resolveFixtureDirectory(fixture.name),
workspace: fixture.name.includes("workspace"),
}));
)
.map((fixture) => ({
...fixture,
dir: resolveFixtureDirectory(fixture.name),
workspace: fixture.name.includes("workspace"),
}))
.filter((fixture) => {
// Bun is not yet supported on Windows
if (isWindows && fixture.packageManager === "bun") {
return false;
}
return true;
});

export function resolveFixtureDirectory(name: string) {
return fileURLToPath(new URL(`fixtures/${name}`, import.meta.url));
Expand Down
5 changes: 0 additions & 5 deletions test/api-workspace.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { expect, it, describe, vi } from "vitest";
import { isWindows } from "std-env";
import { addDependency, removeDependency } from "../src";
import { fixtures } from "./_shared";

describe("api", () => {
for (const fixture of fixtures.filter((f) => f.workspace)) {
// bun is not yet supported on Windows
if (isWindows && fixture.packageManager === "bun") {
continue;
}
describe(fixture.name, () => {
it("adds dependency to the workspace root", async () => {
const addDependencySpy = vi.fn(addDependency);
Expand Down
6 changes: 0 additions & 6 deletions test/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect, it, describe, vi } from "vitest";
import { isWindows } from "std-env";
import {
installDependencies,
addDependency,
Expand All @@ -10,11 +9,6 @@ import { fixtures } from "./_shared";

describe("api (workspace)", () => {
for (const fixture of fixtures.filter((f) => !f.workspace)) {
// bun is not yet supported on Windows
if (isWindows && fixture.packageManager === "bun") {
continue;
}

describe(fixture.name, () => {
it("installs dependencies", async () => {
const installDependenciesSpy = vi.fn(installDependencies);
Expand Down

0 comments on commit 61928fa

Please sign in to comment.