dependabot-nuget 0.258.0 → 0.260.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
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
using System.Threading.Tasks;
|
2
|
-
|
3
1
|
using Xunit;
|
4
2
|
|
5
3
|
namespace NuGetUpdater.Core.Test.Update;
|
@@ -11,37 +9,51 @@ public partial class UpdateWorkerTests
|
|
11
9
|
[Fact]
|
12
10
|
public async Task NoChangeWhenDotNetToolsJsonNotFound()
|
13
11
|
{
|
14
|
-
await TestNoChangeforProject("
|
12
|
+
await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
|
13
|
+
packages:
|
14
|
+
[
|
15
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
16
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
|
17
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
|
18
|
+
],
|
15
19
|
// initial
|
16
20
|
projectContents: """
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
22
|
+
<PropertyGroup>
|
23
|
+
<TargetFramework>net8.0</TargetFramework>
|
24
|
+
</PropertyGroup>
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
<ItemGroup>
|
27
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
28
|
+
</ItemGroup>
|
29
|
+
</Project>
|
30
|
+
"""
|
31
|
+
);
|
27
32
|
}
|
28
33
|
|
29
34
|
[Fact]
|
30
35
|
public async Task NoChangeWhenDependencyNotFound()
|
31
36
|
{
|
32
|
-
await TestNoChangeforProject("
|
37
|
+
await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
|
38
|
+
packages:
|
39
|
+
[
|
40
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
41
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
|
42
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
|
43
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some-Other-Tool", "2.0.0", "net8.0"),
|
44
|
+
],
|
33
45
|
// initial
|
34
46
|
projectContents: """
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
47
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
48
|
+
<PropertyGroup>
|
49
|
+
<TargetFramework>net8.0</TargetFramework>
|
50
|
+
</PropertyGroup>
|
39
51
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
52
|
+
<ItemGroup>
|
53
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
54
|
+
</ItemGroup>
|
55
|
+
</Project>
|
56
|
+
""",
|
45
57
|
additionalFiles:
|
46
58
|
[
|
47
59
|
(".config/dotnet-tools.json", """
|
@@ -49,35 +61,43 @@ public partial class UpdateWorkerTests
|
|
49
61
|
"version": 1,
|
50
62
|
"isRoot": true,
|
51
63
|
"tools": {
|
52
|
-
"
|
53
|
-
"version": "2.
|
64
|
+
"some-other-tool": {
|
65
|
+
"version": "2.0.0",
|
54
66
|
"commands": [
|
55
|
-
"
|
67
|
+
"some-other-tool"
|
56
68
|
]
|
57
69
|
}
|
58
70
|
}
|
59
71
|
}
|
60
72
|
""")
|
61
|
-
]
|
73
|
+
]
|
74
|
+
);
|
62
75
|
}
|
63
76
|
|
64
77
|
[Fact]
|
65
78
|
public async Task NoChangeWhenDotNetToolsJsonInUnexpectedLocation()
|
66
79
|
{
|
67
|
-
await TestNoChangeforProject("
|
80
|
+
await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
|
81
|
+
packages:
|
82
|
+
[
|
83
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
84
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
|
85
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
|
86
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some-Other-Tool", "2.0.0", "net8.0"),
|
87
|
+
],
|
68
88
|
// initial
|
69
89
|
projectFilePath: "src/project/project.csproj",
|
70
90
|
projectContents: """
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
91
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
92
|
+
<PropertyGroup>
|
93
|
+
<TargetFramework>net8.0</TargetFramework>
|
94
|
+
</PropertyGroup>
|
75
95
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
96
|
+
<ItemGroup>
|
97
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
98
|
+
</ItemGroup>
|
99
|
+
</Project>
|
100
|
+
""",
|
81
101
|
additionalFiles:
|
82
102
|
[
|
83
103
|
("eng/.config/dotnet-tools.json", """
|
@@ -85,34 +105,41 @@ public partial class UpdateWorkerTests
|
|
85
105
|
"version": 1,
|
86
106
|
"isRoot": true,
|
87
107
|
"tools": {
|
88
|
-
"
|
89
|
-
"version": "2.
|
108
|
+
"some-other-tool": {
|
109
|
+
"version": "2.0.0",
|
90
110
|
"commands": [
|
91
|
-
"
|
111
|
+
"some-other-tool"
|
92
112
|
]
|
93
113
|
}
|
94
114
|
}
|
95
115
|
}
|
96
116
|
""")
|
97
|
-
]
|
117
|
+
]
|
118
|
+
);
|
98
119
|
}
|
99
120
|
|
100
121
|
[Fact]
|
101
|
-
public async Task
|
122
|
+
public async Task UpdateSingleDependency()
|
102
123
|
{
|
103
|
-
await TestUpdateForProject("
|
124
|
+
await TestUpdateForProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
|
125
|
+
packages:
|
126
|
+
[
|
127
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
128
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
|
129
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
|
130
|
+
],
|
104
131
|
// initial
|
105
132
|
projectContents: """
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
133
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
134
|
+
<PropertyGroup>
|
135
|
+
<TargetFramework>net8.0</TargetFramework>
|
136
|
+
</PropertyGroup>
|
110
137
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
138
|
+
<ItemGroup>
|
139
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
140
|
+
</ItemGroup>
|
141
|
+
</Project>
|
142
|
+
""",
|
116
143
|
additionalFiles:
|
117
144
|
[
|
118
145
|
(".config/dotnet-tools.json", """
|
@@ -120,16 +147,16 @@ public partial class UpdateWorkerTests
|
|
120
147
|
"version": 1,
|
121
148
|
"isRoot": true,
|
122
149
|
"tools": {
|
123
|
-
"
|
150
|
+
"some.dotnet.tool": {
|
124
151
|
"version": "1.0.0",
|
125
152
|
"commands": [
|
126
|
-
"
|
153
|
+
"some.dotnet.tool"
|
127
154
|
]
|
128
155
|
},
|
129
|
-
"
|
156
|
+
"some-other-tool": {
|
130
157
|
"version": "2.1.3",
|
131
158
|
"commands": [
|
132
|
-
"
|
159
|
+
"some-other-tool"
|
133
160
|
]
|
134
161
|
}
|
135
162
|
}
|
@@ -138,16 +165,16 @@ public partial class UpdateWorkerTests
|
|
138
165
|
],
|
139
166
|
// expected
|
140
167
|
expectedProjectContents: """
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
168
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
169
|
+
<PropertyGroup>
|
170
|
+
<TargetFramework>net8.0</TargetFramework>
|
171
|
+
</PropertyGroup>
|
145
172
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
173
|
+
<ItemGroup>
|
174
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
175
|
+
</ItemGroup>
|
176
|
+
</Project>
|
177
|
+
""",
|
151
178
|
additionalFilesExpected:
|
152
179
|
[
|
153
180
|
(".config/dotnet-tools.json", """
|
@@ -155,40 +182,47 @@ public partial class UpdateWorkerTests
|
|
155
182
|
"version": 1,
|
156
183
|
"isRoot": true,
|
157
184
|
"tools": {
|
158
|
-
"
|
185
|
+
"some.dotnet.tool": {
|
159
186
|
"version": "1.1.0",
|
160
187
|
"commands": [
|
161
|
-
"
|
188
|
+
"some.dotnet.tool"
|
162
189
|
]
|
163
190
|
},
|
164
|
-
"
|
191
|
+
"some-other-tool": {
|
165
192
|
"version": "2.1.3",
|
166
193
|
"commands": [
|
167
|
-
"
|
194
|
+
"some-other-tool"
|
168
195
|
]
|
169
196
|
}
|
170
197
|
}
|
171
198
|
}
|
172
199
|
""")
|
173
|
-
]
|
200
|
+
]
|
201
|
+
);
|
174
202
|
}
|
175
203
|
|
176
204
|
[Fact]
|
177
205
|
public async Task UpdateSingleDependencyWithComments()
|
178
206
|
{
|
179
|
-
await TestUpdateForProject("
|
207
|
+
await TestUpdateForProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
|
208
|
+
packages:
|
209
|
+
[
|
210
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
211
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
|
212
|
+
MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
|
213
|
+
],
|
180
214
|
// initial
|
181
215
|
projectContents: """
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
216
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
217
|
+
<PropertyGroup>
|
218
|
+
<TargetFramework>net8.0</TargetFramework>
|
219
|
+
</PropertyGroup>
|
186
220
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
221
|
+
<ItemGroup>
|
222
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
223
|
+
</ItemGroup>
|
224
|
+
</Project>
|
225
|
+
""",
|
192
226
|
additionalFiles:
|
193
227
|
[
|
194
228
|
(".config/dotnet-tools.json", """
|
@@ -197,17 +231,17 @@ public partial class UpdateWorkerTests
|
|
197
231
|
"version": 1,
|
198
232
|
"isRoot": true,
|
199
233
|
"tools": {
|
200
|
-
"
|
234
|
+
"some.dotnet.tool": {
|
201
235
|
// this is a deep comment
|
202
236
|
"version": "1.0.0",
|
203
237
|
"commands": [
|
204
|
-
"
|
238
|
+
"some.dotnet.tool"
|
205
239
|
]
|
206
240
|
},
|
207
|
-
"
|
241
|
+
"some-other-tool": {
|
208
242
|
"version": "2.1.3",
|
209
243
|
"commands": [
|
210
|
-
"
|
244
|
+
"some-other-tool"
|
211
245
|
]
|
212
246
|
}
|
213
247
|
}
|
@@ -216,16 +250,16 @@ public partial class UpdateWorkerTests
|
|
216
250
|
],
|
217
251
|
// expected
|
218
252
|
expectedProjectContents: """
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
253
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
254
|
+
<PropertyGroup>
|
255
|
+
<TargetFramework>net8.0</TargetFramework>
|
256
|
+
</PropertyGroup>
|
223
257
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
258
|
+
<ItemGroup>
|
259
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
260
|
+
</ItemGroup>
|
261
|
+
</Project>
|
262
|
+
""",
|
229
263
|
additionalFilesExpected:
|
230
264
|
[
|
231
265
|
(".config/dotnet-tools.json", """
|
@@ -234,23 +268,24 @@ public partial class UpdateWorkerTests
|
|
234
268
|
"version": 1,
|
235
269
|
"isRoot": true,
|
236
270
|
"tools": {
|
237
|
-
"
|
271
|
+
"some.dotnet.tool": {
|
238
272
|
// this is a deep comment
|
239
273
|
"version": "1.1.0",
|
240
274
|
"commands": [
|
241
|
-
"
|
275
|
+
"some.dotnet.tool"
|
242
276
|
]
|
243
277
|
},
|
244
|
-
"
|
278
|
+
"some-other-tool": {
|
245
279
|
"version": "2.1.3",
|
246
280
|
"commands": [
|
247
|
-
"
|
281
|
+
"some-other-tool"
|
248
282
|
]
|
249
283
|
}
|
250
284
|
}
|
251
285
|
}
|
252
286
|
""")
|
253
|
-
]
|
287
|
+
]
|
288
|
+
);
|
254
289
|
}
|
255
290
|
}
|
256
291
|
}
|