You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Visual Studio 2022中运行QUnit测试脚本时出现异常

解决Visual Studio 2022中运行QUnit JavaScript测试时的"filters参数为空"异常

问题描述

在Visual Studio 2022中运行JavaScript文件的QUnit测试脚本时,抛出以下错误:

System.ArgumentException: 指定的参数不能为空。参数名: filters

完整堆栈跟踪信息:

Executing all tests in file: Main.testfile-test.js
System.ArgumentException: 指定的参数不能为空。
参数名: filters
   在 Microsoft.VisualStudio.TestWindow.Extensibility.ValidateArg.NotNullOrEmpty[T](IEnumerable`1 arg, String parameterName)
   在 Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQueryBySolutionContext.<GetTestContainerConfigurationsInternalAsync>d__7.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQuery.<GetTestContainerConfigurationsAsync>d__18.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Controller.TestRunConfiguration.<UpdateAfterTestDiscoveryAsync>d__9.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__22.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__22.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__22.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<ExecuteInternalAsync>d__23.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Controller.Operation.<<ExecuteAsync>b__43_0>d.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__11`1.MoveNext()

解决方案尝试

  • 重置测试窗口配置:关闭Visual Studio,删除%LOCALAPPDATA%\Microsoft\VisualStudio\17.0_<随机字符>\TestWindow目录下的测试配置文件,重新打开VS后加载解决方案再运行测试。
  • 检查测试发现设置:转到测试 > 测试设置 > 处理器架构,确保选择与项目匹配的架构;确认测试 > 测试设置 > 默认处理器架构配置正确。
  • 修复或更新Visual Studio:打开Visual Studio Installer,选择修改后点击修复,修复损坏的测试组件;同时确保VS2022已更新到最新版本。
  • 检查测试文件和项目配置:确认Main.testfile-test.js中的QUnit测试无语法错误,项目已正确引用QUnit库,测试文件的生成操作设置为内容。
  • 禁用第三方测试扩展:通过扩展 > 管理扩展临时禁用所有第三方测试相关扩展,重新运行测试排查是否为扩展冲突导致问题。

内容的提问来源于stack exchange,提问作者Gourango Ghosh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 21:58:22