Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: normalize the paths to a consistent format #542

Closed
shivarm opened this issue Jan 18, 2025 · 1 comment · Fixed by #560
Closed

Windows: normalize the paths to a consistent format #542

shivarm opened this issue Jan 18, 2025 · 1 comment · Fixed by #560

Comments

@shivarm
Copy link
Contributor

shivarm commented Jan 18, 2025

 FAIL  src/vite/config.test.ts > Should correctly load zudoku.config.ts file
AssertionError: expected 'C:\Users\shivams\Desktop\open-source\…' to include '/with-config/zudoku.config.'
 ❯ src/vite/config.test.ts:14:30
     12|     rootPath,
     13|   );
     14|   expect(config.__meta.path).includes("/with-config/zudoku.config.");
       |                              ^
     15| });
     16|
     16|
     16|
     16|
     16|
     16|

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯                                                       

 Test Files  1 failed | 2 passed | 1 skipped (4)
      Tests  1 failed | 14 passed | 1 skipped (16)
   Start at  08:19:31
   Duration  8.46s (transform 870ms, setup 0ms, collect 7.14s, tests 1.12s, environment 1ms, prepare 1.24s)

 ELIFECYCLE  Test failed. See above for more details.

Solution

// Normalize the path to Unix-style format
  const normalizedPath = config.__meta.path.split(path.sep).join(path.posix.sep);

  expect(normalizedPath).includes("/with-config/zudoku.config.");

Works

> [email protected] test C:\Users\shivams\Desktop\open-source\zudoku\packages\zudoku
> vitest run


 RUN  v2.1.8 C:/Users/shivams/Desktop/open-source/zudoku/packages/zudoku

stdout | src/vite/config.test.ts > Should correctly load zudoku.config.ts file
8:32:18 am zudoku loaded config file C:\Users\shivams\Desktop\open-source\zudoku\examples\with-config\zudoku.config.ts

 ✓ src/vite/config.test.ts (1)
 ↓ src/vite/plugin-docs.test.ts (1) [skipped]
 ✓ src/lib/plugins/openapi/post-processors/removeExtensions.test.ts (4)
 ✓ src/lib/plugins/openapi/post-processors/removePaths.test.ts (10)

 Test Files  3 passed | 1 skipped (4)
      Tests  15 passed | 1 skipped (16)
   Start at  08:32:13
   Duration  5.14s (transform 677ms, setup 0ms, collect 4.59s, tests 263ms, environment 1ms, prepare 1.03s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant