Skip to content

dotnet test does not work for WASM libraries tests #119358

@SingleAccretion

Description

@SingleAccretion

Writing this purely in the spirit of #94183 (comment), feel free to close / move this issue.

Currently if you try to do:

dotnet test /p:TargetOS=wasi /p:TargetArchitecture=wasm .\tests\System.Collections.Specialized.Tests.csproj

It will fail with:

Settings file provided does not conform to required format. An error occurred while loading the settings.  Error: Invalid setting 'RunConfiguration'. Invalid value 'wasm' specified for 'TargetPlatform'..
Unhandled exception. System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.TestPlatform.Client.TestPlatform' threw an exception.
 ---> Microsoft.VisualStudio.TestPlatform.ObjectModel.SettingsException: Invalid settings 'RunConfiguration'.  Invalid value 'wasm' specified for 'TargetPlatform'.
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs:line 781
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetNodeValue[T](String settingsXml, String nodeName, Func`2 nodeParser) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs:line 377
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetRunConfigurationNode(String settingsXml) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs:line 136
   at Microsoft.VisualStudio.TestPlatform.Client.TestPlatform.AddExtensionAssembliesFromExtensionDirectory() in /_/src/vstest/src/Microsoft.TestPlatform.Client/TestPlatform.cs:line 283
   --- End of inner exception stack trace ---

dotnet msbuild /t:Test works as expected:

dotnet msbuild /p:TargetOS=wasi /p:TargetArchitecture=wasm /t:Test .\tests\System.Collections.Specialized.Tests.csproj

...
  info: === TEST EXECUTION SUMMARY ===
  info: Tests run: 2131 Passed: 2123 Inconclusive: 0 Failed: 0 Ignored: 0 Skipped: 8
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions