@@ -17,7 +17,8 @@ describe('formatTargetDir', () => {
1717 expect ( formatTargetDir ( '../../foo/bar' ) ) . matchSnapshot ( ) ;
1818 } ) ;
1919
20- it . skipIf ( process . platform === 'win32' ) ( 'should format target dir with valid input' , ( ) => {
20+ // Should work on all platforms (including Windows) - directory must always use forward slashes
21+ it ( 'should format target dir with valid input' , ( ) => {
2122 expect ( formatTargetDir ( './my-package' ) ) . matchSnapshot ( ) ;
2223 expect ( formatTargetDir ( 'my-package' ) ) . matchSnapshot ( ) ;
2324 expect ( formatTargetDir ( '@my-scope/my-package' ) ) . matchSnapshot ( ) ;
@@ -28,6 +29,17 @@ describe('formatTargetDir', () => {
2829 expect ( formatTargetDir ( './foo/bar/@scope/my-package/sub-package' ) ) . matchSnapshot ( ) ;
2930 } ) ;
3031
32+ // Regression test for https://github.com/voidzero-dev/vite-plus/issues/938
33+ // On Windows, path.join/normalize produce backslashes which break when passed as CLI args.
34+ // Nested paths are the critical cases since they involve path separators.
35+ it ( 'should always use forward slashes in directory (issue #938)' , ( ) => {
36+ expect ( formatTargetDir ( 'foo/@my-scope/my-package' ) . directory ) . toBe ( 'foo/my-package' ) ;
37+ expect ( formatTargetDir ( './foo/bar/@scope/my-package' ) . directory ) . toBe ( 'foo/bar/my-package' ) ;
38+ expect ( formatTargetDir ( './foo/bar/@scope/my-package/sub-package' ) . directory ) . toBe (
39+ 'foo/bar/@scope/my-package/sub-package' ,
40+ ) ;
41+ } ) ;
42+
3143 it ( 'should format target dir with invalid package name' , ( ) => {
3244 expect ( formatTargetDir ( 'my-package@' ) . error ) . matchSnapshot ( ) ;
3345 expect ( formatTargetDir ( 'my-package@1.0.0' ) . error ) . matchSnapshot ( ) ;
0 commit comments