Jest不使用React应用程序运行任何测试

时间:2018-02-27 15:16:06

标签: node.js reactjs testing npm jest

我在React repo中的t.test.js文件中进行了以下简单测试

test('sum', () => {
  expect(1+1).toBe(3);
});

我按照步骤使用the official guide设置了Jest。

但是,当我运行npm test时,没有任何反应。这是我在Jest退出之前获得的输出:

> @ test
> jest

Using Jest CLI v0.8.2, jasmine1

可能是什么问题?我的存储库中没有运行任何测试。如果需要,这是我的package.json的转储:

{
  "private": true,
  "engines": {
    "node": ">=5.0 <6",
    "npm": ">=3.3 <4"
  },
  "dependencies": {
    "@google/maps": "^0.4.5",
    "auth0-lock": "^10.24.3",
    "autosuggest-highlight": "^3.1.1",
    "aws-sdk": "^2.202.0",
    "babel-polyfill": "6.9.1",
    "babel-runtime": "6.9.2",
    "bluebird": "3.1.1",
    "body-parser": "^1.18.2",
    "classnames": "2.2.1",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.3",
    "cron": "^1.3.0",
    "dotenv": "^2.0.0",
    "downloadjs": "^1.4.7",
    "eventemitter3": "1.1.1",
    "express": "4.13.3",
    "express-formidable": "^1.0.0",
    "express-jwt": "^5.1.0",
    "fastclick": "1.0.6",
    "fbjs": "0.5.1",
    "fetch-jsonp": "^1.1.3",
    "flux": "2.1.1",
    "formsy-react": "^0.19.5",
    "front-matter": "2.0.1",
    "fuse.js": "^2.5.0",
    "google-libphonenumber": "^3.0.12",
    "google-map-react": "^0.27.0",
    "google-maps-react": "^1.1.2",
    "history": "1.16.0",
    "intercom-client": "^2.9.2",
    "isomorphic-style-loader": "^4.0.0",
    "jade": "1.11.0",
    "json-loader": "^0.5.7",
    "mailchimp-api-v3": "^1.8.0",
    "markdown": "^0.5.0",
    "mixpanel": "^0.8.0",
    "mixpanel-browser": "^2.17.1",
    "moment": "^2.20.1",
    "moment-timezone": "^0.5.14",
    "mongodb": "2.1.7",
    "morgan": "^1.9.0",
    "node-fetch": "1.3.3",
    "normalize.css": "3.0.3",
    "passport-auth0": "^0.6.1",
    "passport-http": "^0.3.0",
    "rc-progress": "^2.2.5",
    "react": "^0.14.9",
    "react-addons-create-fragment": "^0.14.8",
    "react-autosuggest": "^9.3.4",
    "react-day-picker": "^2.4.0",
    "react-dom": "^0.14.9",
    "react-redux": "^4.4.1",
    "react-routing": "0.0.6",
    "react-scrollable-anchor": "^0.5.0",
    "react-share": "^1.19.1",
    "react-stripe-checkout": "^1.8.0",
    "redux": "^3.3.1",
    "sendgrid": "^2.0.0",
    "source-map-support": "0.4.0",
    "stripe": "^4.25.0",
    "tempy": "^0.2.1",
    "twilio": "^2.9.1",
    "twitter": "^1.7.0",
    "underscore": "^1.8.3",
    "whatwg-fetch": "0.10.1",
    "xhr2": "^0.1.3"
  },
  "devDependencies": {
    "assets-webpack-plugin": "^3.4.0",
    "autoprefixer": "^6.1.2",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-eslint": "^6.0.4",
    "babel-jest": "^22.4.1",
    "babel-loader": "^6.2.4",
    "babel-plugin-react-transform": "^2.0.2",
    "babel-plugin-rewire": "^1.0.0-rc-3",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-react-constant-elements": "^6.8.0",
    "babel-plugin-transform-react-inline-elements": "^6.8.0",
    "babel-plugin-transform-react-remove-prop-types": "^0.2.7",
    "babel-plugin-transform-runtime": "^6.9.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-node5": "^11.1.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-register": "^6.26.0",
    "babel-template": "^6.26.0",
    "babel-types": "^6.26.0",
    "browser-sync": "^2.23.6",
    "css-loader": "^0.28.10",
    "csscomb": "^3.1.8",
    "del": "^2.2.0",
    "eslint": "^1.10.3",
    "eslint-config-airbnb": "^2.1.1",
    "eslint-loader": "^1.1.1",
    "eslint-plugin-react": "^3.11.3",
    "extend": "^3.0.0",
    "file-loader": "^0.8.5",
    "gaze": "^0.5.2",
    "git-repository": "^0.1.1",
    "glob": "^6.0.1",
    "jest": "^22.4.2",
    "jest-cli": "^0.8.2",
    "jscs": "^2.7.0",
    "mkdirp": "^0.5.1",
    "ncp": "^2.0.0",
    "postcss": "^5.2.18",
    "postcss-import": "^7.1.3",
    "postcss-loader": "^0.8.0",
    "precss": "^1.3.0",
    "react-test-renderer": "^16.2.0",
    "react-transform-catch-errors": "^1.0.0",
    "react-transform-hmr": "^1.0.1",
    "redbox-react": "1.2.0",
    "replace": "^0.3.0",
    "superagent": "^3.8.2",
    "supertest": "^3.0.0",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.0",
    "webpack-hot-middleware": "^2.21.0",
    "webpack-middleware": "^1.5.1",
    "webpack-node-externals": "^1.6.0"
  },
  "babel": {
    "presets": [
      "react",
      "node5",
      "stage-0"
    ],
    "env": {
      "test": {
        "plugins": [
          "rewire"
        ]
      }
    },
    "plugins": [
      "transform-class-properties"
    ]
  },
  "jest": {
    "rootDir": "./src"
  },
  "scripts": {
    "lint": "eslint src tools && jscs src tools",
    "csslint": "csscomb src/components --lint --verbose",
    "csscomb": "csscomb src/components --verbose",
    "test": "jest",
    "clean": "babel-node tools/run clean",
    "copy": "babel-node tools/run copy",
    "bundle": "babel-node tools/run bundle",
    "build": "babel-node tools/run build",
    "deploy": "babel-node tools/run deploy",
    "start": "babel-node tools/run start"
  }
}

0 个答案:

没有答案