Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ieedan committed Oct 14, 2024
1 parent 798ff78 commit c2c475a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async function runAdd(cwd: string, config: Config, options: AddOptions) {
title: `${highlight(pm)}: Installing dependencies`,
enabled: dependencies.size > 0,
async task() {
await execa(pm, [add.command, ...add.args], {
await execa(add.command, [...add.args], {
cwd,
});
return `Dependencies installed with ${highlight(pm)}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export async function runInit(cwd: string, config: Config, options: InitOptions)
title: `${highlight(pm)}: Installing dependencies`,
enabled: options.deps,
async task() {
await execa(pm, [add.command, ...add.args], {
await execa(add.command, [...add.args], {
cwd,
});
return `Dependencies installed with ${highlight(pm)}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async function runUpdate(cwd: string, config: Config, options: UpdateOptions) {
title: `${highlight(pm)}: Installing dependencies`,
enabled: dependencies.size > 0,
async task() {
await execa(pm, [add.command, ...add.args], {
await execa(add.command, [...add.args], {
cwd,
});
return `Dependencies installed with ${highlight(pm)}`;
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/src/utils/get-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export async function resolveConfigPaths(cwd: string, config: RawConfig) {
);
}

const utilsPath = resolveImport(config.aliases.utils, pathAliases);
const componentsPath = resolveImport(config.aliases.components, pathAliases);
let utilsPath = resolveImport(config.aliases.utils, pathAliases);
let componentsPath = resolveImport(config.aliases.components, pathAliases);
const aliasError = (type: string, alias: string) =>
new ConfigError(
`Invalid import alias found: (${highlight(`"${type}": "${alias}"`)}) in ${highlight("components.json")}.
Expand All @@ -90,6 +90,9 @@ export async function resolveConfigPaths(cwd: string, config: RawConfig) {
if (utilsPath === undefined) throw aliasError("utils", config.aliases.utils);
if (componentsPath === undefined) throw aliasError("components", config.aliases.components);

utilsPath = path.normalize(utilsPath);
componentsPath = path.normalize(componentsPath);

return v.parse(configSchema, {
...config,
resolvedPaths: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ it("init (config-full)", async () => {
expect(mockMkdir).toHaveBeenNthCalledWith(1, expect.stringContaining("src"), expect.anything());
expect(mockMkdir).toHaveBeenNthCalledWith(
2,
expect.stringContaining("src/lib/components"),
expect.stringContaining("src\\lib\\components"),
expect.anything()
);

Expand Down
4 changes: 3 additions & 1 deletion packages/cli/test/utils/get-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ describe("getConfig", () => {
});

it("handles cases where the project uses jsconfig.json", async () => {
expect(await getConf("config-jsconfig")).toEqual({
const config = await getConf("config-jsconfig");

expect(config).toEqual({
style: "new-york",
tailwind: {
config: "tailwind.config.js",
Expand Down

0 comments on commit c2c475a

Please sign in to comment.