Skip to content

Commit

Permalink
Fix non-cross-platform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
illright committed Jan 13, 2024
1 parent 715bc74 commit 59f0dd2
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 200 deletions.
3 changes: 2 additions & 1 deletion integration-tests/root-detection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import os from "node:os";
import { join } from "node:path";
import { execa } from "execa";
import { getBinPath } from "get-bin-path";
import { deleteAsync } from "del";
import { it, describe, expect } from "vitest";

const temporaryDirectory = await fs.realpath(os.tmpdir());
Expand All @@ -11,7 +12,7 @@ const fsd = (await getBinPath())!;
describe("root detection algorithm", () => {
it("respects the .gitignore file", async () => {
const project = join(temporaryDirectory, "gitignore");
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
["create", "vite", "gitignore", "--template", "vanilla-ts"],
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/smoke-javascript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import os from "node:os";
import { join } from "node:path";
import { execa } from "execa";
import { getBinPath } from "get-bin-path";
import { deleteAsync } from "del";
import { expect, test } from "vitest";

const temporaryDirectory = await fs.realpath(os.tmpdir());
const fsd = (await getBinPath())!;

test("basic functionality in a JavaScript project", async () => {
const project = join(temporaryDirectory, "smoke-javascript");
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
["create", "vite", "smoke-javascript", "--template", "vanilla"],
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/smoke-typescript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import os from "node:os";
import { join } from "node:path";
import { execa } from "execa";
import { getBinPath } from "get-bin-path";
import { deleteAsync } from "del";
import { expect, test } from "vitest";

const temporaryDirectory = await fs.realpath(os.tmpdir());
const fsd = (await getBinPath())!;

test("basic functionality in a TypeScript project", async () => {
const project = join(temporaryDirectory, "smoke-typescript");
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
["create", "vite", "smoke-typescript", "--template", "vanilla-ts"],
Expand Down
11 changes: 6 additions & 5 deletions integration-tests/usage-examples.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import os from "node:os";
import { join } from "node:path";
import { execa } from "execa";
import { getBinPath } from "get-bin-path";
import { deleteAsync } from "del";
import { expect, test, describe } from "vitest";

const temporaryDirectory = await fs.realpath(os.tmpdir());
Expand All @@ -17,7 +18,7 @@ describe.concurrent("the commands specified in usage examples", () => {
const argsSplit = args.split(" ");
test(`widget with segments (${argsSplit[0]})`, async () => {
const project = join(temporaryDirectory, `${argsSplit[0]}-with-segments`);
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
[
Expand Down Expand Up @@ -55,7 +56,7 @@ describe.concurrent("the commands specified in usage examples", () => {
temporaryDirectory,
`${argsSplit[0]}-in-a-slice-group`,
);
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
[
Expand Down Expand Up @@ -88,7 +89,7 @@ describe.concurrent("the commands specified in usage examples", () => {
temporaryDirectory,
`${argsSplit[0]}-in-a-relative-root`,
);
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
[
Expand Down Expand Up @@ -124,7 +125,7 @@ describe.concurrent("the commands specified in usage examples", () => {
temporaryDirectory,
`several-pages-with-segments-${argsSplit[0]}`,
);
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
[
Expand Down Expand Up @@ -168,7 +169,7 @@ describe.concurrent("the commands specified in usage examples", () => {
const argsSplit = args.split(" ");
test(`shared with different segment syntaxes (${index})`, async () => {
const project = join(temporaryDirectory, `shared-with-segments-${index}`);
await execa("rm", ["-rf", project]);
await deleteAsync(project, { force: true });
await execa(
"pnpm",
[
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"chalk": "^5.3.0",
"del": "^7.1.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"execa": "^8.0.1",
Expand All @@ -39,7 +40,7 @@
"prettier": "^3.1.0",
"tsup": "^8.0.1",
"typescript": "^5.3.2",
"vitest": "^0.34.6"
"vitest": "^1.2.0"
},
"bin": {
"fsd": "./dist/main.js"
Expand Down
Loading

0 comments on commit 59f0dd2

Please sign in to comment.