Files
shadcn-ui/packages/tests
shadcn 309d95017f feat(shadcn): alias placeholders in target (#10528)
* feat: add support for package imports

* fix

* test(cli): surface add command failures

* test(cli): remove stale pnpm pin from fixture

* fix(cli): reject invalid package import targets

* fix(cli): address package import review feedback

* feat(shadcn): alias placeholders in target

* docs: update docs for alias and examples

* chore: remove lockfile drift

* chore: clean up

* fix(shadcn): route target aliases by workspace

* docs(registry): document target subdirectories
2026-05-05 14:55:47 +04:00
..
2025-07-29 16:31:10 +04:00
2025-07-29 16:31:10 +04:00
fix
2026-03-02 14:22:31 +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)
  })
})