@@ -30,6 +30,7 @@ import {
3030} from "../../utilities/tasks" ;
3131import { mutable } from "../../utilities/types" ;
3232import { SwiftExecution } from "../../../src/tasks/SwiftExecution" ;
33+ import { SwiftTask } from "../../../src/tasks/SwiftTaskProvider" ;
3334
3435suite ( "SwiftPluginTaskProvider Test Suite" , function ( ) {
3536 let workspaceContext : WorkspaceContext ;
@@ -61,17 +62,20 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
6162 const tasks = await vscode . tasks . fetchTasks ( { type : "swift-plugin" } ) ;
6263 const task = tasks . find ( t => t . name === "command-plugin" ) ;
6364 const swiftExecution = task ?. execution as SwiftExecution ;
64- assert . deepEqual ( swiftExecution . args , [
65- "package" ,
66- "--disable-sandbox" ,
67- "--allow-writing-to-package-directory" ,
68- "--allow-writing-to-directory" ,
69- "/foo" ,
70- "/bar" ,
71- "--allow-network-connections" ,
72- "all" ,
73- "command_plugin" ,
74- ] ) ;
65+ assert . deepEqual (
66+ swiftExecution . args ,
67+ workspaceContext . toolchain . buildFlags . withAdditionalFlags ( [
68+ "package" ,
69+ "--disable-sandbox" ,
70+ "--allow-writing-to-package-directory" ,
71+ "--allow-writing-to-directory" ,
72+ "/foo" ,
73+ "/bar" ,
74+ "--allow-network-connections" ,
75+ "all" ,
76+ "command_plugin" ,
77+ ] )
78+ ) ;
7579 } ) ;
7680 } ) ;
7781
@@ -125,15 +129,20 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
125129
126130 suite ( "provideTasks" , ( ) => {
127131 suite ( "includes command plugin provided by the extension" , async ( ) => {
128- let task : vscode . Task | undefined ;
132+ let task : SwiftTask | undefined ;
129133
130134 setup ( async ( ) => {
131135 const tasks = await vscode . tasks . fetchTasks ( { type : "swift-plugin" } ) ;
132- task = tasks . find ( t => t . name === "command-plugin" ) ;
136+ task = tasks . find ( t => t . name === "command-plugin" ) as SwiftTask ;
133137 } ) ;
134138
135139 test ( "provides" , ( ) => {
136- expect ( task ?. detail ) . to . equal ( "swift package command_plugin" ) ;
140+ expect ( task ?. execution . args ) . to . deep . equal (
141+ workspaceContext . toolchain . buildFlags . withAdditionalFlags ( [
142+ "package" ,
143+ "command_plugin" ,
144+ ] )
145+ ) ;
137146 } ) ;
138147
139148 test ( "executes" , async ( ) => {
@@ -154,7 +163,7 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
154163 } ) ;
155164
156165 test ( "provides" , ( ) => {
157- expect ( task ?. detail ) . to . equal ( "swift package command_plugin --foo" ) ;
166+ expect ( task ?. detail ) . to . include ( "swift package command_plugin --foo" ) ;
158167 } ) ;
159168
160169 test ( "executes" , async ( ) => {
0 commit comments