Skip to content

Commit

Permalink
added test of jsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 committed Jan 5, 2024
1 parent e760f03 commit fd2b640
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/cli/test/fixtures/config-jsconfig/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"style": "new-york",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app.pcss",
"baseColor": "zinc"
},
"aliases": {
"utils": "$lib/utils",
"components": "$lib/components"
}
}
17 changes: 17 additions & 0 deletions packages/cli/test/fixtures/config-jsconfig/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler",
"paths": {
"$lib": ["./src/lib"],
"$lib/*": ["./src/lib/*"]
}
}
}
14 changes: 14 additions & 0 deletions packages/cli/test/fixtures/config-jsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "test-cli-config-full",
"version": "0.0.0",
"private": true,
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
}
37 changes: 37 additions & 0 deletions packages/cli/test/utils/get-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,41 @@ describe("getConfig", () => {
}
});
});

it("handles cases where the project uses jsconfig.json", async () => {
expect(await getConf("config-jsconfig")).toEqual({
style: "new-york",
tailwind: {
config: "tailwind.config.js",
css: "src/app.pcss",
baseColor: "zinc"
},
aliases: {
utils: "$lib/utils",
components: "$lib/components"
},
resolvedPaths: {
components: path.resolve(
__dirname,
"../fixtures/config-jsconfig",
"./src/lib/components"
),
tailwindConfig: path.resolve(
__dirname,
"../fixtures/config-jsconfig",
"./tailwind.config.js"
),
tailwindCss: path.resolve(
__dirname,
"../fixtures/config-jsconfig",
"./src/app.pcss"
),
utils: path.resolve(
__dirname,
"../fixtures/config-jsconfig",
"./src/lib/utils"
)
}
});
});
});

0 comments on commit fd2b640

Please sign in to comment.