您要请求一个 _feature_ 还是报告一个 _bug_?
一个错误。
目前的行为是什么?
故意失败的测试由 Jest 16 报告为通过。 Jest 14 正确地未通过测试。
这是 Jest 16 的输出(参见下方 Jest 14 的输出):
$ npm test
> @ test /Users/macbook/Documents/work/jest-relay-integration-test
> jest
PASS __tests__/Me-test-int.js
PASS __tests__/SignIn-test.js
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 9.316s
Ran all test suites.
如果当前的行为是一个错误,请提供重现的步骤,如果可能的话,我们可以在 GitHub 上提供一个最小的存储库,我们可以npm install
和npm test
。
这是 repro 的 repo。
https://github.com/GrigoryPtashko/jest-relay-integration-test
主分支与 jest 16
jest14 分支与 jest 14
只需克隆它, npm install ,你就会自己看到一切。 使用分支在 Jest 版本之间切换。
什么是预期行为?
预期行为 - 再现中的测试必须失败。 因为它是一个失败的 Relay 集成测试。
这是 Jest 14 的正确输出:
$ npm test
> @ test /Users/macbook/Documents/work/jest-relay-integration-test
> jest
Using Jest CLI v14.1.0, jasmine2
PASS __tests__/SignIn-test.js (3.062s)
FAIL __tests__/Me-test-int.js (4.405s)
● Me › it can make request to /q anyway
- Expected 'ROLE_ANONYMOUS' to equal 'ROLE_ANONYMOUS_AAA'.
at AppRoot.render (__tests__/Me-test-int.js:39:61)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
1 test failed, 1 test passed (2 total in 2 test suites, run time 6.087s)
npm ERR! Test failed. See above for more details.
使用--debug
再次运行 Jest 并提供它打印的完整配置。
$ npm --version
3.10.7
$ node --version
v6.3.0
$ ./node_modules/.bin/jest --debug
jest version = 16.0.1
test framework = jasmine2
config = {
"scriptPreprocessor": "/Users/macbook/Documents/work/jest-relay-integration-test/jestPreprocessor.js",
"moduleNameMapper": [
[
"^.+\\.(scss)$",
"/Users/macbook/Documents/work/jest-relay-integration-test/src/styleMock.js"
]
],
"rootDir": "/Users/macbook/Documents/work/jest-relay-integration-test",
"name": "-Users-macbook-Documents-work-jest-relay-integration-test",
"setupFiles": [],
"testRunner": "/Users/macbook/Documents/work/jest-relay-integration-test/node_modules/jest-jasmine2/build/index.js",
"automock": false,
"bail": false,
"browser": false,
"cacheDirectory": "/var/folders/cs/dzn14j_s1ns7bqbtb5_3w72c0000gn/T/jest",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"globals": {},
"haste": {
"providesModuleNodeModules": []
},
"mocksPattern": "__mocks__",
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node"
],
"modulePathIgnorePatterns": [],
"noStackTrace": false,
"notify": false,
"preset": null,
"preprocessorIgnorePatterns": [
"/node_modules/"
],
"resetModules": false,
"testEnvironment": "jest-environment-jsdom",
"testPathDirs": [
"/Users/macbook/Documents/work/jest-relay-integration-test"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
"testURL": "about:blank",
"timers": "real",
"useStderr": false,
"verbose": null,
"watch": false,
"cache": true,
"watchman": true,
"testcheckOptions": {
"times": 100,
"maxSize": 200
}
}
PASS __tests__/SignIn-test.js
PASS __tests__/Me-test-int.js
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 4.587s, estimated 5s
Ran all test suites.
@cpojer你能看看这个吗? 真想从14更新到16,不知道怎么...
对于未来的研究人员,这是我的 5 美分。 感谢@sibelius,我让它与最新的Jest
,这里是https://github.com/GrigoryPtashko/jest-relay-integration-test。
最有用的评论
@cpojer你能看看这个吗? 真想从14更新到16,不知道怎么...