package.json:

 {
   "name": "flux-pricing",
   "version": "0.0.1",
   "description": "Pricing component with flux",
   "main": "js/app.js",
   "dependencies": {
      "flux": "^2.0.0",
      "jest-cli": "^0.5.0",
      "jsdom": ">= 0.1.23 < 4.0.0",
      "react": "^0.12.0",
      "underscore": "^1.7.0"
   },
  "devDependencies": {
      "browserify": "~6.2.0",
      "envify": "~3.0.0",
      "react": "^0.12.0",
      "reactify": "^0.15",
      "watchify": "~2.1.0",
      "gulp": "~3.8.9",
      "gulp-browserify": "~0.5.0",
      "gulp-concat": "~2.4.1",
      "node-jsx": "~0.2.0",
      "express": "~4.0.0"
     },
     "scripts": {
        "start": "watchify -o js/bundle.js -v -d .",
        "build": "browserify . | uglifyjs -cm > js/bundle.min.js",
        "test": "jest"
    },
   "jest": {
     "rootDir": "./js"
   },
  "browserify": {
     "transform": [
         "reactify",
         "envify"
       ]
   }


}

在npm安装后,当我尝试执行npm测试node.js - reactJs Jest:`jsdom 4.x以上仅适用于io.js,不适用于Node.jsT:-LMLPHP

s \ jsdom \ lib \ jsdom.js:3
`jsdom 4.x及更高版本仅适用于io.js,不适用于Node.jsT:https://github.com/tmpvar
^
意外令牌非法
如何解决这个问题?

最佳答案

我有同样的问题。解决方案是改用Jest 0.4。

这是来自github的问题。
https://github.com/facebook/jest/issues/469#issuecomment-133105627

我实际上必须降级到Jest 0.3和node 10.x才能使Jest React示例正常工作。这是参考
https://github.com/facebook/jest/issues/427

关于node.js - reactJs Jest:`jsdom 4.x以上仅适用于io.js,不适用于Node.jsT:,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32114367/

10-12 12:27
查看更多