@@ -203,6 +203,14 @@ suite("BuildFlags Test Suite", () => {
203203
204204 suite ( "buildDirectoryFromWorkspacePath" , ( ) => {
205205 const buildPathConfig = mockGlobalValue ( configuration , "buildPath" ) ;
206+ const buildArgsConfig = mockGlobalValue ( configuration , "buildArguments" ) ;
207+ const packageArgsConfig = mockGlobalValue ( configuration , "packageArguments" ) ;
208+
209+ beforeEach ( ( ) => {
210+ buildPathConfig . setValue ( "" ) ;
211+ buildArgsConfig . setValue ( [ ] ) ;
212+ packageArgsConfig . setValue ( [ ] ) ;
213+ } ) ;
206214
207215 test ( "no configuration provided" , ( ) => {
208216 buildPathConfig . setValue ( "" ) ;
@@ -239,6 +247,107 @@ suite("BuildFlags Test Suite", () => {
239247 BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
240248 ) . to . equalPath ( "/some/full/workspace/test/path/some/relative/test/path" ) ;
241249 } ) ;
250+
251+ test ( "--scratch-path in buildArguments with separate value" , ( ) => {
252+ buildArgsConfig . setValue ( [ "--scratch-path" , "/custom/scratch/path" ] ) ;
253+
254+ expect (
255+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
256+ ) . to . equalPath ( "/custom/scratch/path" ) ;
257+
258+ expect (
259+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
260+ ) . to . equalPath ( "/custom/scratch/path" ) ;
261+ } ) ;
262+
263+ test ( "--scratch-path in buildArguments with equals format" , ( ) => {
264+ buildArgsConfig . setValue ( [ "--scratch-path=/custom/scratch/path" ] ) ;
265+
266+ expect (
267+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
268+ ) . to . equalPath ( "/custom/scratch/path" ) ;
269+
270+ expect (
271+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
272+ ) . to . equalPath ( "/custom/scratch/path" ) ;
273+ } ) ;
274+
275+ test ( "--scratch-path with relative path in buildArguments" , ( ) => {
276+ buildArgsConfig . setValue ( [ "--scratch-path" , "custom/build" ] ) ;
277+
278+ expect (
279+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
280+ ) . to . equalPath ( "custom/build" ) ;
281+
282+ expect (
283+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
284+ ) . to . equalPath ( "/some/full/workspace/test/path/custom/build" ) ;
285+ } ) ;
286+
287+ test ( "--build-path in buildArguments (legacy support)" , ( ) => {
288+ buildArgsConfig . setValue ( [ "--build-path" , "/legacy/build/path" ] ) ;
289+
290+ expect (
291+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
292+ ) . to . equalPath ( "/legacy/build/path" ) ;
293+
294+ expect (
295+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
296+ ) . to . equalPath ( "/legacy/build/path" ) ;
297+ } ) ;
298+
299+ test ( "--scratch-path in packageArguments" , ( ) => {
300+ packageArgsConfig . setValue ( [ "--scratch-path" , "/package/scratch/path" ] ) ;
301+
302+ expect (
303+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
304+ ) . to . equalPath ( "/package/scratch/path" ) ;
305+
306+ expect (
307+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , true )
308+ ) . to . equalPath ( "/package/scratch/path" ) ;
309+ } ) ;
310+
311+ test ( "buildArguments takes precedence over packageArguments" , ( ) => {
312+ buildArgsConfig . setValue ( [ "--scratch-path" , "/build/args/path" ] ) ;
313+ packageArgsConfig . setValue ( [ "--scratch-path" , "/package/args/path" ] ) ;
314+
315+ expect (
316+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
317+ ) . to . equalPath ( "/build/args/path" ) ;
318+ } ) ;
319+
320+ test ( "buildArguments takes precedence over buildPath config" , ( ) => {
321+ buildPathConfig . setValue ( "/config/path" ) ;
322+ buildArgsConfig . setValue ( [ "--scratch-path" , "/build/args/path" ] ) ;
323+
324+ expect (
325+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
326+ ) . to . equalPath ( "/build/args/path" ) ;
327+ } ) ;
328+
329+ test ( "packageArguments takes precedence over buildPath config" , ( ) => {
330+ buildPathConfig . setValue ( "/config/path" ) ;
331+ packageArgsConfig . setValue ( [ "--scratch-path" , "/package/args/path" ] ) ;
332+
333+ expect (
334+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
335+ ) . to . equalPath ( "/package/args/path" ) ;
336+ } ) ;
337+
338+ test ( "--scratch-path among other arguments" , ( ) => {
339+ buildArgsConfig . setValue ( [
340+ "--verbose" ,
341+ "--scratch-path" ,
342+ "/custom/path" ,
343+ "--configuration" ,
344+ "release" ,
345+ ] ) ;
346+
347+ expect (
348+ BuildFlags . buildDirectoryFromWorkspacePath ( "/some/full/workspace/test/path" , false )
349+ ) . to . equalPath ( "/custom/path" ) ;
350+ } ) ;
242351 } ) ;
243352
244353 suite ( "withAdditionalFlags" , ( ) => {
0 commit comments