【问题标题】:Test suite failed to run Your test suite must contain at least one test.测试套件无法运行 您的测试套件必须至少包含一项测试。
【发布时间】:2018-08-01 05:14:06
【问题描述】:

我收到这个错误

测试套件无法运行

Your test suite must contain at least one test.

  at node_modules/jest-cli/build/test_scheduler.js:108:22

带有开玩笑的配置

"jest": {
    "transform": {
      ".*": "./tests/preprocessor.js"
    },
    "modulePaths": [
      "src"
    ],
  "testPathIgnorePatterns": [
    "/node_modules/",
    "/vendor"
  ],
  "testRegex": "\\.spec\\.js"
  }

任何帮助我该如何解决这个问题 我错过了一些东西

提前致谢 卡洛斯·维埃拉

【问题讨论】:

  • 你能分享它抛出这个错误的文件吗?

标签: webpack-dev-server webpack-2 jestjs


【解决方案1】:

出现此问题是因为您创建了测试文件,但未包含任何测试。
示例:- 以下单元测试仅包含描述部分,不涵盖任何测试(截至目前已评论)

import { mount } from "enzyme";
import React from "react";
import Privileges from "./privileges";

describe("Privileges Component ", () => {
    //const wrapper = mount(<Privileges />).find(".privileges-container");
    
    // it("should render in DOM", () => {

    //     expect(wrapper.length).toEqual(1);
    // });

    
});

【讨论】:

    猜你喜欢
    • 2018-11-23
    • 2017-01-01
    • 2022-12-11
    • 2021-06-26
    • 2019-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    相关资源
    最近更新 更多