@@ -6,6 +6,7 @@ import org.scalasteward.core.buildtool.BuildRoot
6
6
import org .scalasteward .core .buildtool .sbt .command ._
7
7
import org .scalasteward .core .data .{GroupId , Repo , Version }
8
8
import org .scalasteward .core .edit .scalafix .ScalafixMigration
9
+ import org .scalasteward .core .edit .scalafix .ScalafixCli ._
9
10
import org .scalasteward .core .mock .MockContext .context ._
10
11
import org .scalasteward .core .mock .MockState
11
12
import org .scalasteward .core .mock .MockState .TraceEntry .Cmd
@@ -138,13 +139,23 @@ class SbtAlgTest extends FunSuite {
138
139
)
139
140
val initialState = MockState .empty
140
141
.addFiles(
142
+ repoDir / " build.sbt" -> " " ,
141
143
workspace / s " store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json " -> sbtScalafixVersionJson
142
144
)
143
145
.unsafeRunSync()
144
146
val state = sbtAlg.runMigration(buildRoot, migration).runS(initialState).unsafeRunSync()
145
147
val expected = initialState.copy(
146
148
trace = Vector (
147
149
Cmd (" test" , " -d" , s " $repoDir/project " ),
150
+ Cmd (
151
+ " VAR1=val1" ,
152
+ " VAR2=val2" ,
153
+ repoDir.pathAsString,
154
+ scalafixBinary,
155
+ " --syntactic" ,
156
+ " --rules=github:typelevel/sbt-tpolecat/v0_5?sha=v0.5.0" ,
157
+ s " $repoDir/build.sbt "
158
+ ),
148
159
Cmd (
149
160
" read" ,
150
161
s " $workspace/store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json "
@@ -178,7 +189,9 @@ class SbtAlgTest extends FunSuite {
178
189
)
179
190
val initialState = MockState .empty
180
191
.addFiles(
181
- repoDir / " project" / " Dependencies.scala" -> " object Dependencies" , // put anything at all into the meta-build
192
+ repoDir / " build.sbt" -> " " ,
193
+ repoDir / " project" / " plugins.sbt" -> " " ,
194
+ repoDir / " project" / " Dependencies.scala" -> " object Dependencies" ,
182
195
workspace / s " store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json " -> sbtScalafixVersionJson
183
196
)
184
197
.unsafeRunSync()
@@ -187,6 +200,17 @@ class SbtAlgTest extends FunSuite {
187
200
trace = Vector (
188
201
Cmd (" test" , " -d" , s " $repoDir/project " ),
189
202
Cmd (" test" , " -d" , s " $repoDir/project/project " ),
203
+ Cmd (
204
+ " VAR1=val1" ,
205
+ " VAR2=val2" ,
206
+ repoDir.pathAsString,
207
+ scalafixBinary,
208
+ " --syntactic" ,
209
+ " --rules=github:typelevel/sbt-tpolecat/v0_5?sha=v0.5.0" ,
210
+ s " $repoDir/build.sbt " ,
211
+ s " $repoDir/project/Dependencies.scala " ,
212
+ s " $repoDir/project/plugins.sbt "
213
+ ),
190
214
Cmd (
191
215
" read" ,
192
216
s " $workspace/store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json "
@@ -224,13 +248,23 @@ class SbtAlgTest extends FunSuite {
224
248
)
225
249
val initialState = MockState .empty
226
250
.addFiles(
251
+ repoDir / " build.sbt" -> " " ,
227
252
workspace / s " store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json " -> sbtScalafixVersionJson
228
253
)
229
254
.unsafeRunSync()
230
255
val state = sbtAlg.runMigration(buildRoot, migration).runS(initialState).unsafeRunSync()
231
256
val expected = initialState.copy(
232
257
trace = Vector (
233
258
Cmd (" test" , " -d" , s " $repoDir/project " ),
259
+ Cmd (
260
+ " VAR1=val1" ,
261
+ " VAR2=val2" ,
262
+ repoDir.pathAsString,
263
+ scalafixBinary,
264
+ " --syntactic" ,
265
+ " --rules=github:typelevel/sbt-tpolecat/v0_5?sha=v0.5.0" ,
266
+ s " $repoDir/build.sbt "
267
+ ),
234
268
Cmd (
235
269
" read" ,
236
270
s " $workspace/store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json "
@@ -267,7 +301,9 @@ class SbtAlgTest extends FunSuite {
267
301
)
268
302
val initialState = MockState .empty
269
303
.addFiles(
270
- repoDir / " project" / " Dependencies.scala" -> " object Dependencies" , // put anything at all into the meta-build
304
+ repoDir / " build.sbt" -> " " ,
305
+ repoDir / " project" / " plugins.sbt" -> " " ,
306
+ repoDir / " project" / " Dependencies.scala" -> " object Dependencies" ,
271
307
workspace / s " store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json " -> sbtScalafixVersionJson
272
308
)
273
309
.unsafeRunSync()
@@ -276,6 +312,17 @@ class SbtAlgTest extends FunSuite {
276
312
trace = Vector (
277
313
Cmd (" test" , " -d" , s " $repoDir/project " ),
278
314
Cmd (" test" , " -d" , s " $repoDir/project/project " ),
315
+ Cmd (
316
+ " VAR1=val1" ,
317
+ " VAR2=val2" ,
318
+ repoDir.pathAsString,
319
+ scalafixBinary,
320
+ " --syntactic" ,
321
+ " --rules=github:typelevel/sbt-tpolecat/v0_5?sha=v0.5.0" ,
322
+ s " $repoDir/build.sbt " ,
323
+ s " $repoDir/project/Dependencies.scala " ,
324
+ s " $repoDir/project/plugins.sbt "
325
+ ),
279
326
Cmd (
280
327
" read" ,
281
328
s " $workspace/store/versions/v2/https/repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/versions.json "
0 commit comments