node.js-玩笑无限期挂起,不运行任何测试

codeday· 2019-11-11
本文来自 codeday ,作者 codeday
每次我开玩笑时,它什么也不会运行.我让柜台任意高.我用–no-cache开玩笑

jest –debug输出如下:

{
  "configs": [
    {
      "automock": false,
      "browser": false,
      "cache": true,
      "cacheDirectory": "/var/folders/7v/64n1tsk11zs2pbwf5bm_c9kc0000gn/T/jest_dx",
      "clearMocks": false,
      "coveragePathIgnorePatterns": [
        "/node_modules/"
      ],
      "detectLeaks": false,
      "forceCoverageMatch": [],
      "globals": {},
      "haste": {
        "defaultPlatform": "ios",
        "platforms": [
          "android",
          "ios",
          "native"
        ],
        "providesModuleNodeModules": [
          "react-native"
        ]
      },
      "moduleDirectories": [
        "node_modules"
      ],
      "moduleFileExtensions": [
        "js",
        "json",
        "jsx",
        "node"
      ],
      "moduleNameMapper": [
        [
          "^React$",
          "/Users/skilurus/github/flock-react-app/node_modules/react"
        ]
      ],
      "modulePathIgnorePatterns": [
        "/Users/skilurus/github/flock-react-app/node_modules/react-native/Libraries/react-native/"
      ],
      "name": "b29a126b130a0be47202d3bc7b00f1b4",
      "resetMocks": false,
      "resetModules": false,
      "restoreMocks": false,
      "rootDir": "/Users/skilurus/github/flock-react-app",
      "roots": [
        "/Users/skilurus/github/flock-react-app"
      ],
      "runner": "jest-runner",
      "setupFiles": [
        "/Users/skilurus/github/flock-react-app/node_modules/regenerator-runtime/runtime.js",
        "/Users/skilurus/github/flock-react-app/node_modules/react-native/jest/setup.js",
        "/Users/skilurus/github/flock-react-app/test-setup.js"
      ],
      "snapshotSerializers": [
        "/Users/skilurus/github/flock-react-app/node_modules/enzyme-to-json/serializer.js"
      ],
      "testEnvironment": "/Users/skilurus/github/flock-react-app/node_modules/jest-environment-jsdom/build/index.js",
      "testEnvironmentOptions": {},
      "testLocationInResults": false,
      "testMatch": [
        "**/__tests__/**/*.js?(x)",
        "**/?(*.)(spec|test).js?(x)"
      ],
      "testPathIgnorePatterns": [
        "/node_modules/",
        "e2e"
      ],
      "testRegex": "",
      "testRunner": "/Users/skilurus/github/flock-react-app/node_modules/jest-jasmine2/build/index.js",
      "testURL": "about:blank",
      "timers": "real",
      "transform": [
        [
          "^.+\.js$",
          "/Users/skilurus/github/flock-react-app/node_modules/babel-jest/build/index.js"
        ],
        [
          "^[./a-zA-Z0-9$_-]+\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$",
          "/Users/skilurus/github/flock-react-app/node_modules/react-native/jest/assetFileTransformer.js"
        ]
      ],
      "transformIgnorePatterns": [
        "node_modules/(?!react-native|native-base|react-navigation|react-native-fabric|tipsi-stripe)"
      ],
      "watchPathIgnorePatterns": []
    }
  ],
  "globalConfig": {
    "bail": false,
    "changedFilesWithAncestor": false,
    "collectCoverageFrom": [
      "src/**/*.{js,jsx}"
    ],
    "coverageDirectory": "/Users/skilurus/github/flock-react-app/__coverage__",
    "coverageReporters": [
      "json",
      "lcov",
      "text"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 70,
        "functions": 75,
        "lines": 85,
        "statements": 80
      }
    },
    "detectLeaks": false,
    "expand": false,
    "globalSetup": null,
    "globalTeardown": null,
    "listTests": false,
    "mapCoverage": false,
    "maxWorkers": 7,
    "noStackTrace": false,
    "nonFlagArgs": [],
    "notify": false,
    "notifyMode": "always",
    "passWithNoTests": false,
    "rootDir": "/Users/skilurus/github/flock-react-app",
    "runTestsByPath": false,
    "testFailureExitCode": 1,
    "testPathPattern": "",
    "testResultsProcessor": null,
    "updateSnapshot": "new",
    "useStderr": false,
    "verbose": true,
    "watch": false,
    "watchman": true
  },
  "version": "22.3.0"
}

节点-版本:8.9.4

npm –version:5.6.0

纱线-版本1.3.2

有人看过类似的东西吗?有人知道要解决这个问题吗?

最佳答案
这也发生在我身上,但它是断断续续的,但是非常令人沮丧.我发现一种解决方法是使用–runInBand标志运行,该标志仅在同一线程中运行测试:

jest --runInBand