【问题标题】:Why are my Typescript tests shown multiple times in VS Test Explorer using Chutzpah?为什么我的 Typescript 测试使用 Chutzpah 在 VS 测试资源管理器中显示多次?
【发布时间】:2016-06-24 16:07:00
【问题描述】:

我已经在我的 ASP.NET Core 项目中使用我的 Typescript 代码进行 Chutzpah 测试检测。添加另一个测试文件后,尽管所有测试都在测试资源管理器中显示了两次。悬停显示来自一个文件的测试可以在另一个文件中找到,反之亦然。

如何阻止所有重复的测试显示?

这是我的 chutzpah.json:

{
  "Framework": "jasmine",
  "Compile": {
    "Extensions": [ ".ts" ],
    "ExtensionsWithNoOutput": [ ".d.ts" ],
    "Mode": "External",
    "UseSourceMaps": true
  },
  "References": [
    {
      "Includes": [
        "*/scripts/*.ts",
        "*/wwwroot/lib/xxxxxxxxxxxx.js",
        "*/wwwroot/lib/yyyyyyyyyyyy.js",
        "*/wwwroot/lib/zzzzzzzzzzzz.js",
      ],
      "Excludes": [ "*/scripts/*/*.d.ts" ]
    }
  ],
  "Tests": [
    {
      "Includes": [ "*/scripts/test/*.ts" ],
      "Excludes": [ "*/scripts/test/*.d.ts", "*/wwwroot/*" ]
    }
  ]
}

顺便说一句,您可以在 this blog post 中看到我是如何进行测试的,并看到整个项目 on Github

【问题讨论】:

  • 注意:这是使用 VS Community 2015 SP2 和 Chutzpah 4.0。

标签: visual-studio typescript chutzpah


【解决方案1】:

您的参考部分过于宽松,包含您的所有测试代码。看到这个Chutzpah Issue

您也需要更改您的参考资料:

  "References": [
    {
      "Includes": [
        "*/scripts/*.ts",
        "*/wwwroot/lib/xxxxxxxxxxx.js",
        "*/wwwroot/lib/yyyyyyyyyyy.js",
        "*/wwwroot/lib/zzzzzzzzzzz.js",
      ],
      "Excludes": [
        "*/scripts/*/*.d.ts",
        "*/scripts/test/*.ts" // <- Exclude test directory!
      ]
    }
  ],

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-23
    • 2020-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-02
    • 2021-11-05
    相关资源
    最近更新 更多