@@ -72,6 +72,47 @@ type suite struct {
7272func (s * suite ) expectBundled (t * testing.T , args bundled ) {
7373 t .Helper ()
7474 s .__expectBundledImpl (t , args , fs .MockUnix )
75+
76+ // Handle conversion to Windows-style paths
77+ {
78+ files := make (map [string ]string )
79+ for k , v := range args .files {
80+ files [unix2win (k )] = v
81+ }
82+ args .files = files
83+
84+ args .entryPaths = append ([]string {}, args .entryPaths ... )
85+ for i , entry := range args .entryPaths {
86+ args .entryPaths [i ] = unix2win (entry )
87+ }
88+ args .absWorkingDir = unix2win (args .absWorkingDir )
89+
90+ args .options .InjectPaths = append ([]string {}, args .options .InjectPaths ... )
91+ for i , absPath := range args .options .InjectPaths {
92+ args .options .InjectPaths [i ] = unix2win (absPath )
93+ }
94+
95+ aliases := make (map [string ]string )
96+ for k , v := range args .options .PackageAliases {
97+ if strings .HasPrefix (v , "/" ) {
98+ v = unix2win (v )
99+ }
100+ aliases [k ] = v
101+ }
102+ args .options .PackageAliases = aliases
103+
104+ replace := make (map [string ]bool )
105+ for k , v := range args .options .ExternalSettings .PostResolve .Exact {
106+ replace [unix2win (k )] = v
107+ }
108+ args .options .ExternalSettings .PostResolve .Exact = replace
109+
110+ args .options .AbsOutputFile = unix2win (args .options .AbsOutputFile )
111+ args .options .AbsOutputBase = unix2win (args .options .AbsOutputBase )
112+ args .options .AbsOutputDir = unix2win (args .options .AbsOutputDir )
113+ args .options .TSConfigPath = unix2win (args .options .TSConfigPath )
114+ }
115+
75116 s .__expectBundledImpl (t , args , fs .MockWindows )
76117}
77118
@@ -103,7 +144,11 @@ func (s *suite) __expectBundledImpl(t *testing.T, args bundled, fsKind fs.MockKi
103144 args .options .ExtensionOrder = []string {".tsx" , ".ts" , ".jsx" , ".js" , ".css" , ".json" }
104145 }
105146 if args .options .AbsOutputFile != "" {
106- args .options .AbsOutputDir = path .Dir (args .options .AbsOutputFile )
147+ if fsKind == fs .MockWindows {
148+ args .options .AbsOutputDir = unix2win (path .Dir (win2unix (args .options .AbsOutputFile )))
149+ } else {
150+ args .options .AbsOutputDir = path .Dir (args .options .AbsOutputFile )
151+ }
107152 }
108153 if args .options .Mode == config .ModeBundle || (args .options .Mode == config .ModeConvertFormat && args .options .OutputFormat == config .FormatIIFE ) {
109154 // Apply this default to all tests since it was not configurable when the tests were written
@@ -123,42 +168,16 @@ func (s *suite) __expectBundledImpl(t *testing.T, args bundled, fsKind fs.MockKi
123168 }
124169 entryPoints = append (entryPoints , args .entryPathsAdvanced ... )
125170 if args .absWorkingDir == "" {
126- args .absWorkingDir = "/"
171+ if fsKind == fs .MockWindows {
172+ args .absWorkingDir = "C:\\ "
173+ } else {
174+ args .absWorkingDir = "/"
175+ }
127176 }
128177 if args .options .AbsOutputDir == "" {
129178 args .options .AbsOutputDir = args .absWorkingDir // Match the behavior of the API in this case
130179 }
131180
132- // Handle conversion to Windows-style paths
133- if fsKind == fs .MockWindows {
134- for i , entry := range entryPoints {
135- entry .InputPath = unix2win (entry .InputPath )
136- entryPoints [i ] = entry
137- }
138- args .absWorkingDir = unix2win (args .absWorkingDir )
139-
140- for i , absPath := range args .options .InjectPaths {
141- args .options .InjectPaths [i ] = unix2win (absPath )
142- }
143-
144- for key , value := range args .options .PackageAliases {
145- if strings .HasPrefix (value , "/" ) {
146- args .options .PackageAliases [key ] = unix2win (value )
147- }
148- }
149-
150- replace := make (map [string ]bool )
151- for k , v := range args .options .ExternalSettings .PostResolve .Exact {
152- replace [unix2win (k )] = v
153- }
154- args .options .ExternalSettings .PostResolve .Exact = replace
155-
156- args .options .AbsOutputFile = unix2win (args .options .AbsOutputFile )
157- args .options .AbsOutputBase = unix2win (args .options .AbsOutputBase )
158- args .options .AbsOutputDir = unix2win (args .options .AbsOutputDir )
159- args .options .TSConfigPath = unix2win (args .options .TSConfigPath )
160- }
161-
162181 // Run the bundler
163182 log := logger .NewDeferLog (logKind , nil )
164183 caches := cache .MakeCacheSet ()
0 commit comments