【问题标题】:Visual Studio Test Explorer does not discover jasmine testsVisual Studio 测试资源管理器未发现 jasmine 测试
【发布时间】:2015-01-12 19:22:49
【问题描述】:

我有通过 Chutzpah 上下文菜单扩展运行的 jasmine 测试(运行 JS 测试)。但是测试资源管理器没有发现它们,当我右键单击并选择运行测试时,“测试”的输出给了我这个:

System.ArgumentException: The directory name  is invalid.
   at System.IO.FileSystemWatcher..ctor(String path, String filter)
   at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.

这也是我的 chutzpah.json 文件:

{
    "Framework": "jasmine",
    "FrameworkVersion": "2",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "References": [
        { "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
        { "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
        { "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
        { "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
        { "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
        { "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/core.js" },

        { "Path": "prepare.js" },
        { "Path": "engine.js" }
    ],

    "Tests": [
        { "Path": "tests" }
    ],

    "CodeCoverageIncludes": [],
    "CodeCoverageExcludes": []
}

Solution structure:
DIB.MemberCatalog
  -Testing
    - DIB.MemberCatalog.Tests.JS
      - data
      - lib
        - jasmine-2.0.0
          - (jasmine files, boot, console, jasmine)
      - tests
        - testfiles.js
      - chutzpah.json
  -DIB.MemberCatalog
    - (more...)

我搜索了互联网,但找不到解决方案。

【问题讨论】:

  • 您可能不想要根路径(以/ 开头的路径),因为 Chutzpah 会在您的驱动器根目录中查找这些文件。
  • 谢谢,问题已更新。仍然不是修复。
  • 你的解决方案结构是什么样的?
  • 您可能希望将 Include 属性添加到您的 Tests 数组中:类似于: { "Path": "tests", "Include": "*Spec.js" } 如果仍然没有帮助 我确实注意到在新的开发机器上安装 Resharper 导致 Chutzpah 测试发现停止工作。如果您最近安装了它,您可能需要将其删除,看看这是否能解决您的问题。
  • @jessehouwing - 我已经用我的结构更新了这个问题。 njappboy - 试过了,没有任何改变。

标签: visual-studio-2012 jasmine chutzpah


【解决方案1】:

通过将我的测试项目名称从 DIB.MemberCatalog.Tests.JS 更改为 DIB.MemberCatalog.Tests.Client 解决。当项目在项目名称的末尾有 javascript 文件扩展名时会发生混淆。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-20
    • 2019-06-23
    相关资源
    最近更新 更多