Jasmine 测试在 Chutzpah 下运行时会因超时而随机失败

问题描述 投票:0回答:1

我一直在努力让Cuttzpah 和Jasmine 打得好。这是一个不再积极维护的遗留项目,所以我正在尝试使用我目前拥有的东西。

使用 Chutzpah 运行测试时,我收到各种各样的虚假错误:

  • 测试超过异步超时
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
    • 绝大多数抛出此错误的测试都是完全同步的,并且不使用 Promise、async/await 或
      done()
      回调。
    • 重新运行这些精确的测试几乎会立即通过,运行时间低于 100 毫秒。
  • 随机未定义对象
    Uncaught TypeError: Cannot read properties of undefined (reading '<object>') thrown
    • 仅发生在大规模测试套件中的单个测试中。
    • 重新运行这些精确的测试将通过且不会出现任何警告。

该项目的前端是用 Knockout、Durandel 和 RequireJS 构建的。以下是我的

Chutzpah.json
:

{
    "Framework": "jasmine",
    "FrameworkVersion": "2",
    "TestHarnessReferenceMode": "AMD",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "References": [
        { "Path": "require.js" },
        { "Path": "config.js" }
    ],
    "Tests": [{ "Path": "specs" }],
    "CodeCoverageIncludes": ["*\\app\\*"],
    "CodeCoverageSuccessPercentage": 84, //currently our lowest completely tested file percentage
    "Engine": "Chrome",
    "EngineOptions": {
        "ChromeBrowserPath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
    },
    "TestFileTimeout": 20000
}
jasmine timeout chutzpah
1个回答
0
投票

我的问题最终是 Chutzpah 无法同时运行多个测试而不超时。将并行度值设置为 1,您的测试应该会停止超时。

© www.soinside.com 2019 - 2024. All rights reserved.