mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-09 06:55:07 +00:00
* fix(transform): Support aliases that are longer than one character * feat(shadcn): update handling of aliases * chore: add changeset --------- Co-authored-by: shadcn <m@shadcn.com>
40 lines
814 B
TypeScript
40 lines
814 B
TypeScript
import path from "path"
|
|
import { describe, expect, test } from "vitest"
|
|
|
|
import { getTsConfigAliasPrefix } from "../../src/utils/get-project-info"
|
|
|
|
describe("get ts config alias prefix", async () => {
|
|
test.each([
|
|
{
|
|
name: "next-app",
|
|
prefix: "@",
|
|
},
|
|
{
|
|
name: "next-app-src",
|
|
prefix: "#",
|
|
},
|
|
{
|
|
name: "next-pages",
|
|
prefix: "~",
|
|
},
|
|
{
|
|
name: "next-pages-src",
|
|
prefix: "@",
|
|
},
|
|
{
|
|
name: "t3-app",
|
|
prefix: "~",
|
|
},
|
|
{
|
|
name: "next-app-custom-alias",
|
|
prefix: "@custom-alias",
|
|
},
|
|
])(`getTsConfigAliasPrefix($name) -> $prefix`, async ({ name, prefix }) => {
|
|
expect(
|
|
await getTsConfigAliasPrefix(
|
|
path.resolve(__dirname, `../fixtures/frameworks/${name}`)
|
|
)
|
|
).toBe(prefix)
|
|
})
|
|
})
|