@@ -30,6 +30,7 @@ import {
30
30
} from "../../utilities/tasks" ;
31
31
import { mutable } from "../../utilities/types" ;
32
32
import { SwiftExecution } from "../../../src/tasks/SwiftExecution" ;
33
+ import { SwiftTask } from "../../../src/tasks/SwiftTaskProvider" ;
33
34
34
35
suite ( "SwiftPluginTaskProvider Test Suite" , function ( ) {
35
36
let workspaceContext : WorkspaceContext ;
@@ -61,17 +62,20 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
61
62
const tasks = await vscode . tasks . fetchTasks ( { type : "swift-plugin" } ) ;
62
63
const task = tasks . find ( t => t . name === "command-plugin" ) ;
63
64
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
+ ) ;
75
79
} ) ;
76
80
} ) ;
77
81
@@ -125,15 +129,20 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
125
129
126
130
suite ( "provideTasks" , ( ) => {
127
131
suite ( "includes command plugin provided by the extension" , async ( ) => {
128
- let task : vscode . Task | undefined ;
132
+ let task : SwiftTask | undefined ;
129
133
130
134
setup ( async ( ) => {
131
135
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 ;
133
137
} ) ;
134
138
135
139
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
+ ) ;
137
146
} ) ;
138
147
139
148
test ( "executes" , async ( ) => {
@@ -154,7 +163,7 @@ suite("SwiftPluginTaskProvider Test Suite", function () {
154
163
} ) ;
155
164
156
165
test ( "provides" , ( ) => {
157
- expect ( task ?. detail ) . to . equal ( "swift package command_plugin --foo" ) ;
166
+ expect ( task ?. detail ) . to . include ( "swift package command_plugin --foo" ) ;
158
167
} ) ;
159
168
160
169
test ( "executes" , async ( ) => {
0 commit comments