reactJs Jest:`jsdom 4.x以前只能用于io.js,而不是Node.jsT:

的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安装后,当我尝试做npmtesting 在这里输入图像说明

s \ jsdom \ lib \ jsdom.js:3`jsdom 4.x onward只能用于io.js,而不是Node.jsT: https : //github.com/tmpvar ^意外的标记ILLEGAL如何解决这个问题?

我有同样的问题。 解决scheme是切换到使用Jest 0.4。

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

我实际上必须降级到Jest 0.3和10.x节点才能获得Jest React示例。 这里是参考https://github.com/facebook/jest/issues/427