Skip to content

Commit fb1e620

Browse files
committed
bun test instead of vitest
1 parent 49c46cd commit fb1e620

File tree

1 file changed

+183
-195
lines changed

1 file changed

+183
-195
lines changed

apps/cli/test/git-hooks.test.ts

Lines changed: 183 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,200 @@
1-
import { describe, it } from "vitest";
1+
import { test } from "bun:test";
22
import type { GitHooks } from "../src/types";
33
import { runTRPCTest, expectSuccess } from "./test-utils";
44

5-
describe("Git Hooks Configurations", () => {
6-
describe("Individual Git Hook Options", () => {
7-
const gitHookOptions = ["husky", "lefthook", "none"] as GitHooks[];
8-
9-
for (const gitHook of gitHookOptions) {
10-
it(`should work with ${gitHook} git hooks`, async () => {
11-
const result = await runTRPCTest({
12-
projectName: `${gitHook}-git-hooks`,
13-
gitHooks: gitHook,
14-
frontend: ["tanstack-router"],
15-
backend: "hono",
16-
runtime: "bun",
17-
database: "sqlite",
18-
orm: "drizzle",
19-
auth: "none",
20-
api: "trpc",
21-
examples: ["none"],
22-
dbSetup: "none",
23-
webDeploy: "none",
24-
serverDeploy: "none",
25-
install: false,
26-
});
27-
28-
expectSuccess(result);
29-
});
30-
}
5+
const gitHookOptions = ["husky", "lefthook", "none"] as GitHooks[];
6+
7+
for (const gitHook of gitHookOptions) {
8+
test(`Git Hooks Configurations - should work with ${gitHook} git hooks`, async () => {
9+
const result = await runTRPCTest({
10+
projectName: `${gitHook}-git-hooks`,
11+
gitHooks: gitHook,
12+
frontend: ["tanstack-router"],
13+
backend: "hono",
14+
runtime: "bun",
15+
database: "sqlite",
16+
orm: "drizzle",
17+
auth: "none",
18+
api: "trpc",
19+
examples: ["none"],
20+
dbSetup: "none",
21+
webDeploy: "none",
22+
serverDeploy: "none",
23+
install: false,
24+
});
25+
26+
expectSuccess(result);
27+
});
28+
}
29+
30+
test("Lefthook Linter Integration - should work with lefthook + biome", async () => {
31+
const result = await runTRPCTest({
32+
projectName: "lefthook-biome",
33+
addons: ["biome"],
34+
gitHooks: "lefthook",
35+
frontend: ["tanstack-router"],
36+
backend: "hono",
37+
runtime: "bun",
38+
database: "sqlite",
39+
orm: "drizzle",
40+
auth: "none",
41+
api: "trpc",
42+
examples: ["none"],
43+
dbSetup: "none",
44+
webDeploy: "none",
45+
serverDeploy: "none",
46+
install: false,
3147
});
3248

33-
describe("Lefthook Linter Integration", () => {
34-
it("should work with lefthook + biome", async () => {
35-
const result = await runTRPCTest({
36-
projectName: "lefthook-biome",
37-
addons: ["biome"],
38-
gitHooks: "lefthook",
39-
frontend: ["tanstack-router"],
40-
backend: "hono",
41-
runtime: "bun",
42-
database: "sqlite",
43-
orm: "drizzle",
44-
auth: "none",
45-
api: "trpc",
46-
examples: ["none"],
47-
dbSetup: "none",
48-
webDeploy: "none",
49-
serverDeploy: "none",
50-
install: false,
51-
});
52-
53-
expectSuccess(result);
54-
});
49+
expectSuccess(result);
50+
});
5551

56-
it("should work with lefthook + oxlint", async () => {
57-
const result = await runTRPCTest({
58-
projectName: "lefthook-oxlint",
59-
addons: ["oxlint"],
60-
gitHooks: "lefthook",
61-
frontend: ["tanstack-router"],
62-
backend: "hono",
63-
runtime: "bun",
64-
database: "sqlite",
65-
orm: "drizzle",
66-
auth: "none",
67-
api: "trpc",
68-
examples: ["none"],
69-
dbSetup: "none",
70-
webDeploy: "none",
71-
serverDeploy: "none",
72-
install: false,
73-
});
74-
75-
expectSuccess(result);
76-
});
52+
test("Lefthook Linter Integration - should work with lefthook + oxlint", async () => {
53+
const result = await runTRPCTest({
54+
projectName: "lefthook-oxlint",
55+
addons: ["oxlint"],
56+
gitHooks: "lefthook",
57+
frontend: ["tanstack-router"],
58+
backend: "hono",
59+
runtime: "bun",
60+
database: "sqlite",
61+
orm: "drizzle",
62+
auth: "none",
63+
api: "trpc",
64+
examples: ["none"],
65+
dbSetup: "none",
66+
webDeploy: "none",
67+
serverDeploy: "none",
68+
install: false,
69+
});
7770

78-
it("should work with lefthook alone (no linter)", async () => {
79-
const result = await runTRPCTest({
80-
projectName: "lefthook-standalone",
81-
gitHooks: "lefthook",
82-
frontend: ["tanstack-router"],
83-
backend: "hono",
84-
runtime: "bun",
85-
database: "sqlite",
86-
orm: "drizzle",
87-
auth: "none",
88-
api: "trpc",
89-
examples: ["none"],
90-
dbSetup: "none",
91-
webDeploy: "none",
92-
serverDeploy: "none",
93-
install: false,
94-
});
95-
96-
expectSuccess(result);
97-
});
71+
expectSuccess(result);
72+
});
73+
74+
test("Lefthook Linter Integration - should work with lefthook alone (no linter)", async () => {
75+
const result = await runTRPCTest({
76+
projectName: "lefthook-standalone",
77+
gitHooks: "lefthook",
78+
frontend: ["tanstack-router"],
79+
backend: "hono",
80+
runtime: "bun",
81+
database: "sqlite",
82+
orm: "drizzle",
83+
auth: "none",
84+
api: "trpc",
85+
examples: ["none"],
86+
dbSetup: "none",
87+
webDeploy: "none",
88+
serverDeploy: "none",
89+
install: false,
9890
});
9991

100-
describe("Husky Integration", () => {
101-
it("should work with husky + biome", async () => {
102-
const result = await runTRPCTest({
103-
projectName: "husky-biome",
104-
addons: ["biome"],
105-
gitHooks: "husky",
106-
frontend: ["tanstack-router"],
107-
backend: "hono",
108-
runtime: "bun",
109-
database: "sqlite",
110-
orm: "drizzle",
111-
auth: "none",
112-
api: "trpc",
113-
examples: ["none"],
114-
dbSetup: "none",
115-
webDeploy: "none",
116-
serverDeploy: "none",
117-
install: false,
118-
});
119-
120-
expectSuccess(result);
121-
});
92+
expectSuccess(result);
93+
});
12294

123-
it("should work with husky + oxlint", async () => {
124-
const result = await runTRPCTest({
125-
projectName: "husky-oxlint",
126-
addons: ["oxlint"],
127-
gitHooks: "husky",
128-
frontend: ["tanstack-router"],
129-
backend: "hono",
130-
runtime: "bun",
131-
database: "sqlite",
132-
orm: "drizzle",
133-
auth: "none",
134-
api: "trpc",
135-
examples: ["none"],
136-
dbSetup: "none",
137-
webDeploy: "none",
138-
serverDeploy: "none",
139-
install: false,
140-
});
141-
142-
expectSuccess(result);
143-
});
95+
test("Husky Integration - should work with husky + biome", async () => {
96+
const result = await runTRPCTest({
97+
projectName: "husky-biome",
98+
addons: ["biome"],
99+
gitHooks: "husky",
100+
frontend: ["tanstack-router"],
101+
backend: "hono",
102+
runtime: "bun",
103+
database: "sqlite",
104+
orm: "drizzle",
105+
auth: "none",
106+
api: "trpc",
107+
examples: ["none"],
108+
dbSetup: "none",
109+
webDeploy: "none",
110+
serverDeploy: "none",
111+
install: false,
112+
});
144113

145-
it("should work with husky alone (no linter)", async () => {
146-
const result = await runTRPCTest({
147-
projectName: "husky-standalone",
148-
gitHooks: "husky",
149-
frontend: ["tanstack-router"],
150-
backend: "hono",
151-
runtime: "bun",
152-
database: "sqlite",
153-
orm: "drizzle",
154-
auth: "none",
155-
api: "trpc",
156-
examples: ["none"],
157-
dbSetup: "none",
158-
webDeploy: "none",
159-
serverDeploy: "none",
160-
install: false,
161-
});
162-
163-
expectSuccess(result);
164-
});
114+
expectSuccess(result);
115+
});
116+
117+
test("Husky Integration - should work with husky + oxlint", async () => {
118+
const result = await runTRPCTest({
119+
projectName: "husky-oxlint",
120+
addons: ["oxlint"],
121+
gitHooks: "husky",
122+
frontend: ["tanstack-router"],
123+
backend: "hono",
124+
runtime: "bun",
125+
database: "sqlite",
126+
orm: "drizzle",
127+
auth: "none",
128+
api: "trpc",
129+
examples: ["none"],
130+
dbSetup: "none",
131+
webDeploy: "none",
132+
serverDeploy: "none",
133+
install: false,
165134
});
166135

167-
describe("Hooks with Addons", () => {
168-
it("should work with multiple addons + hooks", async () => {
169-
const result = await runTRPCTest({
170-
projectName: "multiple-addons-with-hooks",
171-
addons: ["biome", "turborepo", "pwa"],
172-
gitHooks: "lefthook",
173-
frontend: ["tanstack-router"],
174-
backend: "hono",
175-
runtime: "bun",
176-
database: "sqlite",
177-
orm: "drizzle",
178-
auth: "none",
179-
api: "trpc",
180-
examples: ["none"],
181-
dbSetup: "none",
182-
webDeploy: "none",
183-
serverDeploy: "none",
184-
install: false,
185-
});
186-
187-
expectSuccess(result);
188-
});
136+
expectSuccess(result);
137+
});
138+
139+
test("Husky Integration - should work with husky alone (no linter)", async () => {
140+
const result = await runTRPCTest({
141+
projectName: "husky-standalone",
142+
gitHooks: "husky",
143+
frontend: ["tanstack-router"],
144+
backend: "hono",
145+
runtime: "bun",
146+
database: "sqlite",
147+
orm: "drizzle",
148+
auth: "none",
149+
api: "trpc",
150+
examples: ["none"],
151+
dbSetup: "none",
152+
webDeploy: "none",
153+
serverDeploy: "none",
154+
install: false,
189155
});
190156

191-
describe("Hooks Default Behavior", () => {
192-
it("should use default hooks when not specified", async () => {
193-
const result = await runTRPCTest({
194-
projectName: "default-hooks",
195-
frontend: ["tanstack-router"],
196-
backend: "hono",
197-
runtime: "bun",
198-
database: "sqlite",
199-
orm: "drizzle",
200-
auth: "none",
201-
api: "trpc",
202-
examples: ["none"],
203-
dbSetup: "none",
204-
webDeploy: "none",
205-
serverDeploy: "none",
206-
install: false,
207-
});
208-
209-
expectSuccess(result);
210-
});
157+
expectSuccess(result);
158+
});
159+
160+
test("Hooks with Addons - should work with multiple addons + hooks", async () => {
161+
const result = await runTRPCTest({
162+
projectName: "multiple-addons-with-hooks",
163+
addons: ["biome", "turborepo", "pwa"],
164+
gitHooks: "lefthook",
165+
frontend: ["tanstack-router"],
166+
backend: "hono",
167+
runtime: "bun",
168+
database: "sqlite",
169+
orm: "drizzle",
170+
auth: "none",
171+
api: "trpc",
172+
examples: ["none"],
173+
dbSetup: "none",
174+
webDeploy: "none",
175+
serverDeploy: "none",
176+
install: false,
211177
});
178+
179+
expectSuccess(result);
180+
});
181+
182+
test("Hooks Default Behavior - should use default hooks when not specified", async () => {
183+
const result = await runTRPCTest({
184+
projectName: "default-hooks",
185+
frontend: ["tanstack-router"],
186+
backend: "hono",
187+
runtime: "bun",
188+
database: "sqlite",
189+
orm: "drizzle",
190+
auth: "none",
191+
api: "trpc",
192+
examples: ["none"],
193+
dbSetup: "none",
194+
webDeploy: "none",
195+
serverDeploy: "none",
196+
install: false,
197+
});
198+
199+
expectSuccess(result);
212200
});

0 commit comments

Comments
 (0)