Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Git user
shell: bash
run: |
git config --global user.name github-actions[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Install Dependencies
run: bun install --frozen-lockfile
env:
BTS_TELEMETRY: 1
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}

- name: Run Tests
run: bun test --timeout 15000

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ yarn-error.log*
.vscode
.env*.local

.smoke
.smoke

.idea
11 changes: 10 additions & 1 deletion apps/cli/test/addons.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { describe, it } from "vitest";
import { afterAll, beforeAll, describe, it } from "vitest";
import type { Addons, Frontend } from "../src";
import {
cleanupSmokeDirectory,
expectError,
expectSuccess,
runTRPCTest,
type TestConfig,
} from "./test-utils";

describe("Addon Configurations", () => {
beforeAll(async () => {
await cleanupSmokeDirectory();
});

afterAll(async () => {
await cleanupSmokeDirectory();
});

describe("Universal Addons (no frontend restrictions)", () => {
const universalAddons = ["biome", "husky", "turborepo", "oxlint"];

Expand Down
11 changes: 10 additions & 1 deletion apps/cli/test/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it } from "vitest";
import { afterAll, beforeAll, describe, it } from "vitest";
import type {
API,
Backend,
Expand All @@ -10,13 +10,22 @@ import type {
} from "../src/types";
import {
API_TYPES,
cleanupSmokeDirectory,
expectError,
expectSuccess,
runTRPCTest,
type TestConfig,
} from "./test-utils";

describe("API Configurations", () => {
beforeAll(async () => {
await cleanupSmokeDirectory();
});

afterAll(async () => {
await cleanupSmokeDirectory();
});

describe("tRPC API", () => {
it("should work with tRPC + React frontends", async () => {
const reactFrontends = [
Expand Down
16 changes: 14 additions & 2 deletions apps/cli/test/auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { describe, it } from "vitest";
import { afterAll, beforeAll, describe, it } from "vitest";
import type { Backend, Database, Frontend, ORM } from "../src/types";
import {
AUTH_PROVIDERS,
cleanupSmokeDirectory,
expectError,
expectSuccess,
runTRPCTest,
type TestConfig,
} from "./test-utils";

describe("Authentication Configurations", () => {
beforeAll(async () => {
await cleanupSmokeDirectory();
});

afterAll(async () => {
await cleanupSmokeDirectory();
});

describe("Better-Auth Provider", () => {
it("should work with better-auth + database", async () => {
const result = await runTRPCTest({
Expand Down Expand Up @@ -95,7 +104,10 @@ describe("Authentication Configurations", () => {
expectError: true,
});

expectError(result, "Authentication requires a database");
expectError(
result,
"The 'todo' example requires a database if a backend (other than Convex) is present. Cannot use --examples todo when database is 'none' and a backend is selected.",
);
});

it("should work with better-auth + convex backend (tanstack-router)", async () => {
Expand Down
13 changes: 11 additions & 2 deletions apps/cli/test/backend-runtime.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { describe, it } from "vitest";
import { afterAll, beforeAll, describe, it } from "vitest";
import type { Backend, Frontend, Runtime } from "../src/types";
import {
cleanupSmokeDirectory,
expectError,
expectSuccess,
runTRPCTest,
type TestConfig,
} from "./test-utils";

describe("Backend and Runtime Combinations", () => {
beforeAll(async () => {
await cleanupSmokeDirectory();
});

afterAll(async () => {
await cleanupSmokeDirectory();
});

describe("Valid Backend-Runtime Combinations", () => {
const validCombinations = [
// Standard backend-runtime combinations
Expand Down Expand Up @@ -464,7 +473,7 @@ describe("Backend and Runtime Combinations", () => {

expectError(
result,
"Backend 'self' (fullstack) currently only supports Next.js frontend. Please use --frontend next. Support for Nuxt, SvelteKit, and TanStack Start will be added in a future update.",
"Backend 'self' (fullstack) currently only supports Next.js and TanStack Start frontends. Please use --frontend next or --frontend tanstack-start. Support for Nuxt and SvelteKit will be added in a future update.",
);
});

Expand Down
11 changes: 10 additions & 1 deletion apps/cli/test/basic-configurations.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { describe, expect, it } from "vitest";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import {
cleanupSmokeDirectory,
expectError,
expectSuccess,
PACKAGE_MANAGERS,
runTRPCTest,
} from "./test-utils";

describe("Basic Configurations", () => {
beforeAll(async () => {
await cleanupSmokeDirectory();
});

afterAll(async () => {
await cleanupSmokeDirectory();
});

describe("Default Configuration", () => {
it("should create project with --yes flag (default config)", async () => {
const result = await runTRPCTest({
Expand Down
Loading