Aldaviva/WinampNowPlayingToFile

Get tests and maybe coverage working in CI

Aldaviva opened this issue · 1 comments

The test project was failing to compile when I was working on #6 due to the following error, so I skipped that project by explicitly building the C++ plugin project instead of the entire solution.

3>D:\a\WinampNowPlayingToFile\WinampNowPlayingToFile\Test\Test.csproj(155,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\xunit.core.2.4.1\build\xunit.core.props.

I have since updated the Test project to xUnit 2.4.2, the latest stable version available, and tests do compile and pass on my development computer.

It may be worth trying once again to get the tests running in CI, and maybe add coverage reporting too.

Well that fucking sucked.

  • I forgot that the test which relied on a file outside my repository would fail when run on a different computer, even though I looked at that test and thought I should fix it recently.
  • Can't run tests with dotnet test because dotnet can't target just one project, so it tries to build all projects in the solution, but one of the projects is a C++ project it can't build, so you have to build with dotnet build & dotnet publish and run with dotnet vstest.
  • Old MSBuild C# (not .NET SDK-style) files need a special undocumented <RuntimeIdentifiers>win;win-x64;win-x86</RuntimeIdentifiers> to make package locks work.
  • Visual Studio hides packages.lock.json in old MSBuild C# projects, but not in new .NET SDK-style projects.
  • Tests were silently freezing on a missing folder, which was not remotely debuggable.
  • dotnet vstest saves test output folder in solution directory, not test project directory.
  • Visual Studio build tools installs NuGet without adding NuGet Gallery as a package source, unlike the Visual Studio IDE
  • Git cannot resolve path equality with differing slash styles when validating safe directories
  • This isn't news to me, but you can't propagate changes to environment variables in services unless you restart your entire operating system, which is pretty inconvenient