File tree Expand file tree Collapse file tree 5 files changed +57
-4
lines changed
template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content
MSTest-CSharp/.template.config
MSTest-FSharp/.template.config
MSTest-VisualBasic/.template.config
Playwright-MSTest-CSharp/.template.config
test/dotnet-new.IntegrationTests Expand file tree Collapse file tree 5 files changed +57
-4
lines changed Original file line number Diff line number Diff line change 227227 "id" : " restoreNugetPackages" ,
228228 "continueOnError" : true
229229 },
230+ {
231+ "condition" : " (TestRunner == \" Microsoft.Testing.Platform\" )" ,
232+ "description" : " Create or update 'dotnet.config' file required by Microsoft.Testing.Platform." ,
233+ "manualInstructions" : [{ "text" : " Manually create 'dotnet.config' file setting the test runner to Microsoft.Testing.Platform" }],
234+ "actionId" : " 597E7933-0D87-452C-B094-8FA0EEF7FD97" ,
235+ "id" : " createOrUpdateDotnetConfig" ,
236+ "args" : {
237+ "section" : " dotnet.test.runner" ,
238+ "key" : " name" ,
239+ "value" : " Microsoft.Testing.Platform" ,
240+ },
241+ "continueOnError" : true
242+ },
230243 {
231244 "condition" : " (HostIdentifier != \" dotnetcli\" && HostIdentifier != \" dotnetcli-preview\" )" ,
232245 "description" : " Opens Test1.cs in the editor" ,
Original file line number Diff line number Diff line change 227227 "id" : " restoreNugetPackages" ,
228228 "continueOnError" : true
229229 },
230+ {
231+ "condition" : " (TestRunner == \" Microsoft.Testing.Platform\" )" ,
232+ "description" : " Create or update 'dotnet.config' file required by Microsoft.Testing.Platform." ,
233+ "manualInstructions" : [{ "text" : " Manually create 'dotnet.config' file setting the test runner to Microsoft.Testing.Platform" }],
234+ "actionId" : " 597E7933-0D87-452C-B094-8FA0EEF7FD97" ,
235+ "id" : " createOrUpdateDotnetConfig" ,
236+ "args" : {
237+ "section" : " dotnet.test.runner" ,
238+ "key" : " name" ,
239+ "value" : " Microsoft.Testing.Platform" ,
240+ },
241+ "continueOnError" : true
242+ },
230243 {
231244 "condition" : " (HostIdentifier != \" dotnetcli\" && HostIdentifier != \" dotnetcli-preview\" )" ,
232245 "description" : " Opens Test1.fs in the editor" ,
Original file line number Diff line number Diff line change 227227 "id" : " restoreNugetPackages" ,
228228 "continueOnError" : true
229229 },
230+ {
231+ "condition" : " (TestRunner == \" Microsoft.Testing.Platform\" )" ,
232+ "description" : " Create or update 'dotnet.config' file required by Microsoft.Testing.Platform." ,
233+ "manualInstructions" : [{ "text" : " Manually create 'dotnet.config' file setting the test runner to Microsoft.Testing.Platform" }],
234+ "actionId" : " 597E7933-0D87-452C-B094-8FA0EEF7FD97" ,
235+ "id" : " createOrUpdateDotnetConfig" ,
236+ "args" : {
237+ "section" : " dotnet.test.runner" ,
238+ "key" : " name" ,
239+ "value" : " Microsoft.Testing.Platform" ,
240+ },
241+ "continueOnError" : true
242+ },
230243 {
231244 "condition" : " (HostIdentifier != \" dotnetcli\" && HostIdentifier != \" dotnetcli-preview\" )" ,
232245 "description" : " Opens Test1.vb in the editor" ,
Original file line number Diff line number Diff line change 247247 "id" : " restoreNugetPackages" ,
248248 "continueOnError" : true
249249 },
250+ {
251+ "condition" : " (TestRunner == \" Microsoft.Testing.Platform\" )" ,
252+ "description" : " Create or update 'dotnet.config' file required by Microsoft.Testing.Platform." ,
253+ "manualInstructions" : [{ "text" : " Manually create 'dotnet.config' file setting the test runner to Microsoft.Testing.Platform" }],
254+ "actionId" : " 597E7933-0D87-452C-B094-8FA0EEF7FD97" ,
255+ "id" : " createOrUpdateDotnetConfig" ,
256+ "args" : {
257+ "section" : " dotnet.test.runner" ,
258+ "key" : " name" ,
259+ "value" : " Microsoft.Testing.Platform" ,
260+ },
261+ "continueOnError" : true
262+ },
250263 {
251264 "condition" : " (HostIdentifier != \" dotnetcli\" && HostIdentifier != \" dotnetcli-preview\" )" ,
252265 "description" : " Opens Test1.cs in the editor" ,
Original file line number Diff line number Diff line change @@ -180,6 +180,10 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can
180180 {
181181 string testProjectName = GenerateTestProjectName ( ) ;
182182 string outputDirectory = CreateTemporaryFolder ( folderName : "Home" ) ;
183+
184+ // Prevent the dotnet.config post action from walking up the directory parents up to our own solution root, which would affect other tests.
185+ Directory . CreateDirectory ( Path . Combine ( outputDirectory , ".git" ) ) ;
186+
183187 string workingDirectory = CreateTemporaryFolder ( ) ;
184188
185189 // Create new test project: dotnet new <projectTemplate> -n <testProjectName> -f <targetFramework> -lang <language> --coverage-tool <coverageTool> --test-runner <testRunner>
@@ -196,10 +200,7 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can
196200 var isMTP = testRunner == "Microsoft.Testing.Platform" ;
197201 if ( isMTP )
198202 {
199- File . WriteAllText ( Path . Combine ( outputDirectory , "dotnet.config" ) , """
200- [dotnet.test.runner]
201- name = "Microsoft.Testing.Platform"
202- """ ) ;
203+ File . Exists ( Path . Combine ( outputDirectory , "dotnet.config" ) ) . Should ( ) . BeTrue ( ) ;
203204 }
204205
205206 var result = new DotnetTestCommand ( _log , false )
You can’t perform that action at this time.
0 commit comments