dependabot-nuget 0.257.0 → 0.259.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
- data/helpers/lib/NuGetUpdater/global.json +6 -0
- data/lib/dependabot/nuget/file_parser.rb +4 -5
- data/lib/dependabot/nuget/file_updater.rb +1 -1
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
- data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
- data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
- data/lib/dependabot/nuget/update_checker.rb +1 -0
- metadata +8 -5
@@ -1,7 +1,3 @@
|
|
1
|
-
using System.IO;
|
2
|
-
using System.Linq;
|
3
|
-
using System.Threading.Tasks;
|
4
|
-
|
5
1
|
using Xunit;
|
6
2
|
|
7
3
|
namespace NuGetUpdater.Core.Test.Update;
|
@@ -13,94 +9,111 @@ public partial class UpdateWorkerTests
|
|
13
9
|
[Fact]
|
14
10
|
public async Task UpdateSingleDependencyInDirsProj()
|
15
11
|
{
|
16
|
-
await TestUpdateForDirsProj("
|
12
|
+
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
13
|
+
packages:
|
14
|
+
[
|
15
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
16
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
17
|
+
],
|
17
18
|
// initial
|
18
19
|
projectContents: """
|
19
|
-
|
20
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
<ItemGroup>
|
23
|
+
<ProjectReference Include="src/test-project.csproj" />
|
24
|
+
</ItemGroup>
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
</Project>
|
27
|
+
""",
|
27
28
|
additionalFiles:
|
28
29
|
[
|
29
30
|
("src/test-project.csproj",
|
30
31
|
"""
|
31
32
|
<Project Sdk="Microsoft.NET.Sdk">
|
32
33
|
<PropertyGroup>
|
33
|
-
<TargetFramework>
|
34
|
+
<TargetFramework>net8.0</TargetFramework>
|
34
35
|
</PropertyGroup>
|
35
36
|
|
36
37
|
<ItemGroup>
|
37
|
-
<PackageReference Include="
|
38
|
+
<PackageReference Include="Some.Package" Version="9.0.1" />
|
38
39
|
</ItemGroup>
|
39
40
|
</Project>
|
40
41
|
""")
|
41
42
|
],
|
42
43
|
// expected
|
43
44
|
expectedProjectContents: """
|
44
|
-
|
45
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
<ItemGroup>
|
48
|
+
<ProjectReference Include="src/test-project.csproj" />
|
49
|
+
</ItemGroup>
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
</Project>
|
52
|
+
""",
|
52
53
|
additionalFilesExpected:
|
53
54
|
[
|
54
55
|
("src/test-project.csproj",
|
55
56
|
"""
|
56
57
|
<Project Sdk="Microsoft.NET.Sdk">
|
57
58
|
<PropertyGroup>
|
58
|
-
<TargetFramework>
|
59
|
+
<TargetFramework>net8.0</TargetFramework>
|
59
60
|
</PropertyGroup>
|
60
61
|
|
61
62
|
<ItemGroup>
|
62
|
-
<PackageReference Include="
|
63
|
+
<PackageReference Include="Some.Package" Version="13.0.1" />
|
63
64
|
</ItemGroup>
|
64
65
|
</Project>
|
65
66
|
""")
|
66
|
-
]
|
67
|
+
]
|
68
|
+
);
|
67
69
|
}
|
68
70
|
|
69
71
|
[Fact]
|
70
72
|
public async Task Update_MissingFileDoesNotThrow()
|
71
73
|
{
|
72
|
-
await TestUpdateForDirsProj("
|
74
|
+
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
75
|
+
packages:
|
76
|
+
[
|
77
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
78
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
79
|
+
],
|
73
80
|
projectContents: """
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
81
|
+
<Project Sdk="Microsoft.Build.Traversal">
|
82
|
+
<ItemGroup>
|
83
|
+
<ProjectReference Include="private\dirs.proj" />
|
84
|
+
</ItemGroup>
|
85
|
+
</Project>
|
86
|
+
""",
|
80
87
|
expectedProjectContents: """
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
additionalFiles: []
|
88
|
+
<Project Sdk="Microsoft.Build.Traversal">
|
89
|
+
<ItemGroup>
|
90
|
+
<ProjectReference Include="private\dirs.proj" />
|
91
|
+
</ItemGroup>
|
92
|
+
</Project>
|
93
|
+
""",
|
94
|
+
additionalFiles: []
|
95
|
+
);
|
88
96
|
}
|
89
97
|
|
90
98
|
[Fact]
|
91
99
|
public async Task UpdateSingleDependencyInNestedDirsProj()
|
92
100
|
{
|
93
|
-
await TestUpdateForDirsProj("
|
101
|
+
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
102
|
+
packages:
|
103
|
+
[
|
104
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
105
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
106
|
+
],
|
94
107
|
// initial
|
95
108
|
projectContents: """
|
96
|
-
|
109
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
97
110
|
|
98
|
-
|
99
|
-
|
100
|
-
|
111
|
+
<ItemGroup>
|
112
|
+
<ProjectReference Include="src/dirs.proj" />
|
113
|
+
</ItemGroup>
|
101
114
|
|
102
|
-
|
103
|
-
|
115
|
+
</Project>
|
116
|
+
""",
|
104
117
|
additionalFiles:
|
105
118
|
[
|
106
119
|
("src/dirs.proj",
|
@@ -117,25 +130,25 @@ public partial class UpdateWorkerTests
|
|
117
130
|
"""
|
118
131
|
<Project Sdk="Microsoft.NET.Sdk">
|
119
132
|
<PropertyGroup>
|
120
|
-
<TargetFramework>
|
133
|
+
<TargetFramework>net8.0</TargetFramework>
|
121
134
|
</PropertyGroup>
|
122
135
|
|
123
136
|
<ItemGroup>
|
124
|
-
<PackageReference Include="
|
137
|
+
<PackageReference Include="Some.Package" Version="9.0.1" />
|
125
138
|
</ItemGroup>
|
126
139
|
</Project>
|
127
140
|
""")
|
128
141
|
],
|
129
142
|
// expected
|
130
143
|
expectedProjectContents: """
|
131
|
-
|
144
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
132
145
|
|
133
|
-
|
134
|
-
|
135
|
-
|
146
|
+
<ItemGroup>
|
147
|
+
<ProjectReference Include="src/dirs.proj" />
|
148
|
+
</ItemGroup>
|
136
149
|
|
137
|
-
|
138
|
-
|
150
|
+
</Project>
|
151
|
+
""",
|
139
152
|
additionalFilesExpected:
|
140
153
|
[
|
141
154
|
("src/dirs.proj",
|
@@ -152,31 +165,37 @@ public partial class UpdateWorkerTests
|
|
152
165
|
"""
|
153
166
|
<Project Sdk="Microsoft.NET.Sdk">
|
154
167
|
<PropertyGroup>
|
155
|
-
<TargetFramework>
|
168
|
+
<TargetFramework>net8.0</TargetFramework>
|
156
169
|
</PropertyGroup>
|
157
170
|
|
158
171
|
<ItemGroup>
|
159
|
-
<PackageReference Include="
|
172
|
+
<PackageReference Include="Some.Package" Version="13.0.1" />
|
160
173
|
</ItemGroup>
|
161
174
|
</Project>
|
162
175
|
""")
|
163
|
-
]
|
176
|
+
]
|
177
|
+
);
|
164
178
|
}
|
165
179
|
|
166
180
|
[Fact]
|
167
181
|
public async Task UpdateSingleDependencyInNestedDirsProjUsingWildcard()
|
168
182
|
{
|
169
|
-
await TestUpdateForDirsProj("
|
183
|
+
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
184
|
+
packages:
|
185
|
+
[
|
186
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
187
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
188
|
+
],
|
170
189
|
// initial
|
171
190
|
projectContents: """
|
172
|
-
|
191
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
173
192
|
|
174
|
-
|
175
|
-
|
176
|
-
|
193
|
+
<ItemGroup>
|
194
|
+
<ProjectReference Include="src/*.proj" />
|
195
|
+
</ItemGroup>
|
177
196
|
|
178
|
-
|
179
|
-
|
197
|
+
</Project>
|
198
|
+
""",
|
180
199
|
additionalFiles:
|
181
200
|
[
|
182
201
|
("src/dirs.proj",
|
@@ -193,25 +212,25 @@ public partial class UpdateWorkerTests
|
|
193
212
|
"""
|
194
213
|
<Project Sdk="Microsoft.NET.Sdk">
|
195
214
|
<PropertyGroup>
|
196
|
-
<TargetFramework>
|
215
|
+
<TargetFramework>net8.0</TargetFramework>
|
197
216
|
</PropertyGroup>
|
198
217
|
|
199
218
|
<ItemGroup>
|
200
|
-
<PackageReference Include="
|
219
|
+
<PackageReference Include="Some.Package" Version="9.0.1" />
|
201
220
|
</ItemGroup>
|
202
221
|
</Project>
|
203
222
|
""")
|
204
223
|
],
|
205
224
|
// expected
|
206
225
|
expectedProjectContents: """
|
207
|
-
|
226
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
208
227
|
|
209
|
-
|
210
|
-
|
211
|
-
|
228
|
+
<ItemGroup>
|
229
|
+
<ProjectReference Include="src/*.proj" />
|
230
|
+
</ItemGroup>
|
212
231
|
|
213
|
-
|
214
|
-
|
232
|
+
</Project>
|
233
|
+
""",
|
215
234
|
additionalFilesExpected:
|
216
235
|
[
|
217
236
|
("src/dirs.proj",
|
@@ -228,31 +247,37 @@ public partial class UpdateWorkerTests
|
|
228
247
|
"""
|
229
248
|
<Project Sdk="Microsoft.NET.Sdk">
|
230
249
|
<PropertyGroup>
|
231
|
-
<TargetFramework>
|
250
|
+
<TargetFramework>net8.0</TargetFramework>
|
232
251
|
</PropertyGroup>
|
233
252
|
|
234
253
|
<ItemGroup>
|
235
|
-
<PackageReference Include="
|
254
|
+
<PackageReference Include="Some.Package" Version="13.0.1" />
|
236
255
|
</ItemGroup>
|
237
256
|
</Project>
|
238
257
|
""")
|
239
|
-
]
|
258
|
+
]
|
259
|
+
);
|
240
260
|
}
|
241
261
|
|
242
262
|
[Fact]
|
243
263
|
public async Task UpdateSingleDependencyInNestedDirsProjUsingRecursiveWildcard()
|
244
264
|
{
|
245
|
-
await TestUpdateForDirsProj("
|
265
|
+
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
266
|
+
packages:
|
267
|
+
[
|
268
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
269
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
270
|
+
],
|
246
271
|
// initial
|
247
272
|
projectContents: """
|
248
|
-
|
273
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
249
274
|
|
250
|
-
|
251
|
-
|
252
|
-
|
275
|
+
<ItemGroup>
|
276
|
+
<ProjectReference Include="**/*.proj" />
|
277
|
+
</ItemGroup>
|
253
278
|
|
254
|
-
|
255
|
-
|
279
|
+
</Project>
|
280
|
+
""",
|
256
281
|
additionalFiles:
|
257
282
|
[
|
258
283
|
("src/dirs.proj",
|
@@ -269,25 +294,25 @@ public partial class UpdateWorkerTests
|
|
269
294
|
"""
|
270
295
|
<Project Sdk="Microsoft.NET.Sdk">
|
271
296
|
<PropertyGroup>
|
272
|
-
<TargetFramework>
|
297
|
+
<TargetFramework>net8.0</TargetFramework>
|
273
298
|
</PropertyGroup>
|
274
299
|
|
275
300
|
<ItemGroup>
|
276
|
-
<PackageReference Include="
|
301
|
+
<PackageReference Include="Some.Package" Version="9.0.1" />
|
277
302
|
</ItemGroup>
|
278
303
|
</Project>
|
279
304
|
""")
|
280
305
|
],
|
281
306
|
// expected
|
282
307
|
expectedProjectContents: """
|
283
|
-
|
308
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
284
309
|
|
285
|
-
|
286
|
-
|
287
|
-
|
310
|
+
<ItemGroup>
|
311
|
+
<ProjectReference Include="**/*.proj" />
|
312
|
+
</ItemGroup>
|
288
313
|
|
289
|
-
|
290
|
-
|
314
|
+
</Project>
|
315
|
+
""",
|
291
316
|
additionalFilesExpected:
|
292
317
|
[
|
293
318
|
("src/dirs.proj",
|
@@ -304,15 +329,16 @@ public partial class UpdateWorkerTests
|
|
304
329
|
"""
|
305
330
|
<Project Sdk="Microsoft.NET.Sdk">
|
306
331
|
<PropertyGroup>
|
307
|
-
<TargetFramework>
|
332
|
+
<TargetFramework>net8.0</TargetFramework>
|
308
333
|
</PropertyGroup>
|
309
334
|
|
310
335
|
<ItemGroup>
|
311
|
-
<PackageReference Include="
|
336
|
+
<PackageReference Include="Some.Package" Version="13.0.1" />
|
312
337
|
</ItemGroup>
|
313
338
|
</Project>
|
314
339
|
""")
|
315
|
-
]
|
340
|
+
]
|
341
|
+
);
|
316
342
|
}
|
317
343
|
|
318
344
|
static async Task TestUpdateForDirsProj(
|
@@ -323,7 +349,8 @@ public partial class UpdateWorkerTests
|
|
323
349
|
string expectedProjectContents,
|
324
350
|
bool isTransitive = false,
|
325
351
|
(string Path, string Content)[]? additionalFiles = null,
|
326
|
-
(string Path, string Content)[]? additionalFilesExpected = null
|
352
|
+
(string Path, string Content)[]? additionalFilesExpected = null,
|
353
|
+
MockNuGetPackage[]? packages = null)
|
327
354
|
{
|
328
355
|
additionalFiles ??= [];
|
329
356
|
additionalFilesExpected ??= [];
|
@@ -334,6 +361,8 @@ public partial class UpdateWorkerTests
|
|
334
361
|
|
335
362
|
var actualResult = await RunUpdate(testFiles, async (temporaryDirectory) =>
|
336
363
|
{
|
364
|
+
await MockNuGetPackagesInDirectory(packages, temporaryDirectory);
|
365
|
+
|
337
366
|
var projectPath = Path.Combine(temporaryDirectory, projectFileName);
|
338
367
|
var worker = new UpdaterWorker(new Logger(verbose: true));
|
339
368
|
await worker.RunAsync(temporaryDirectory, projectPath, dependencyName, oldVersion, newVersion, isTransitive);
|