Files
shadcn-ui/packages/tests
shadcn 873f7f2773 feat: add tests package (#7907)
* feat: add tests package

* fix

* fix

* debug

* debug

* debug

* fix

* debug

* fix: no concurrent

* fix

* test: add vite-app tests

* test: add tests
2025-07-29 16:31:10 +04:00
..
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00

Tests

This package contains integration tests that verify the shadcn CLI works correctly with a local registry. The tests run actual CLI commands against test fixtures to ensure files are created and updated properly.

Running Tests

Run the following command from the root of the workspace:

pnpm tests:test

Writing Tests

import {
  createFixtureTestDirectory,
  fileExists,
  npxShadcn,
} from "../utils/helpers"

describe("my test suite", () => {
  it("should do something", async () => {
    // Create a test directory from a fixture
    const testDir = await createFixtureTestDirectory("next-app")

    // Run CLI command
    await npxShadcn(testDir, ["init", "--base-color=neutral"])

    // Make assertions
    expect(await fileExists(path.join(testDir, "components.json"))).toBe(true)
  })
})