mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

VS2022 Extension Test Discovery Error #811

Open pfranceschi25 opened 2 years ago

pfranceschi25 commented 2 years ago

I'm getting the following error during test discovery:

========== Starting test discovery ========== Chutzpah Error: System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at Chutzpah.Server.ChutzpahWebServerFactory.BuildHost(String rootPath, Int32 defaultPort, String builtInDependencyFolder) at Chutzpah.Server.ChutzpahWebServerFactory.CreateServer(ChutzpahWebServerConfiguration configuration, IChutzpahWebServerHost activeWebServerHost) at Chutzpah.TestRunner.SetupWebServerHost(ConcurrentBag1 testContexts, TestOptions options) at Chutzpah.TestRunner.ProcessTestPaths(IEnumerable1 testPaths, TestOptions options, TestExecutionMode testExecutionMode, ITestMethodRunnerCallback callback, IChutzpahWebServerHost activeWebServerHost)

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

An exception occurred while test discoverer 'ChutzpahTestDiscoverer' was loading tests. Exception: Could not load type 'Chutzpah.VS2012.TestAdapter.ChutzpahTracingHelper' from assembly 'Chutzpah.VS.Common, Version=4.4.12.0, Culture=neutral, PublicKeyToken=1ca802c37ffe1896'. ========== Test discovery finished: 0 Tests found in 1.8 sec ==========

I'm running a .NET Framework 4.8 project and jasmine 3.5.0 in VS 2022. Chutzpah nuget package version is also 4.4.12. The same project was previously working in VS2019, and Chutzpah v4.4.10.

I am able to run tests using context menus.

Any help would be appreciated. Thanks for all you do!

pfranceschi25 commented 2 years ago

I ran the project in a different computer and now I get a different FileNotFoundException, this time missing Newtonsoft.Json v13.0.0.0.

I don't understand where these package requirements are coming from. The Chutzpah NuGet package has no dependencies. Can someone enlighten me?

M0ns1gn0r commented 2 years ago

I have the same problem. Not sure why it suddenly started to happen: either because I updated VS 2022 to the latest or because I started to use Chrome as the default engine (and ES6 in tests).

openHawkes commented 1 year ago

I'm receiving the same issue after swapping to Visual Studio 2022 and using the new extension.

Building Test Projects
========== Starting test run ==========
Chutzpah Error: System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Chutzpah.Server.ChutzpahWebServerFactory.BuildHost(String rootPath, Int32 defaultPort, String builtInDependencyFolder)
   at Chutzpah.Server.ChutzpahWebServerFactory.CreateServer(ChutzpahWebServerConfiguration configuration, IChutzpahWebServerHost activeWebServerHost)
   at Chutzpah.TestRunner.SetupWebServerHost(ConcurrentBag`1 testContexts, TestOptions options)
   at Chutzpah.TestRunner.ProcessTestPaths(IEnumerable`1 testPaths, TestOptions options, TestExecutionMode testExecutionMode, ITestMethodRunnerCallback callback, IChutzpahWebServerHost activeWebServerHost)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 241.4 ms ==========

I tried installing the nuget for DiagnosticsSource, though 4.0.3 isn't an option, only 4.0.0 (and 5.0+ versions), but still received the same error afterwards.

nuget installation info

When I use the Test Explorer to run tests, these are skipped. Some js tests are run, however. Not sure what's up.

chutzpah extension info

Going back to VS 2019 and using the old runner works.

supremedictator commented 1 year ago

I am also receiving the same problem.

VS2022 Version 17.7.0 .Net 4.8 Project Chutzpah Test Explorer Adapter v4.4.12

Error: System.InvalidOperationException: Process must exit before requested information can be determined.
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.get_ExitCode()
   at Chutzpah.ProcessHelper.RunExecutableAndProcessOutput(String exePath, String arguments, Func`2 streamProcessor, Int32 streamTimeout, IDictionary`2 environmentVars)
   at Chutzpah.PhantomTestExecutionProvider.Execute(TestOptions testOptions, TestContext testContext, TestExecutionMode testExecutionMode, ITestMethodRunnerCallback callback)
   at Chutzpah.TestRunner.InvokeTestRunner(TestOptions options, TestContext testContext, TestExecutionMode testExecutionMode, ITestMethodRunnerCallback callback)
   at Chutzpah.TestRunner.<>c__DisplayClass39_0.<ExecuteTestContexts>b__0(TestContext testContext)

Has anyone been able to work around this?