_๊ธฐ๋ฅ_์ ์์ฒญํ์๊ฒ ์ต๋๊น? ์๋๋ฉด _๋ฒ๊ทธ_๋ฅผ ๋ณด๊ณ ํ์๊ฒ ์ต๋๊น?
๋ฒ๊ทธ.
ํ์ฌ ํ๋์ ๋ฌด์์ ๋๊น?
๊ณ ์๋ก ์คํจํ ํ ์คํธ๋ 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
ํ ์ ์๋ ์ต์ ์ ์ฅ์๋ฅผ ์ ๊ณตํ์ญ์์ค.
์ฌ๊ธฐ repo์ ๋ํ repo๊ฐ โโ์์ต๋๋ค.
https://github.com/GrigoryPtashko/jest-relay-integration-test
jest 16์ด ์๋ ๋ง์คํฐ ๋ธ๋์น
jest 14๊ฐ ์๋ jest14 ๋ถ๊ธฐ
๋ณต์ ํ๊ณ npm์ ์ค์นํ๋ฉด ๋ชจ๋ ๊ฒ์ ์ง์ ๋ณผ ์ ์์ต๋๋ค. ๋ถ๊ธฐ๋ฅผ ์ฌ์ฉํ์ฌ Jest ๋ฒ์ ๊ฐ์ ์ ํํฉ๋๋ค.
์์๋๋ ๋์์ ๋ฌด์์ ๋๊น?
์์๋๋ ๋์ - ์ฌํ์ ํ
์คํธ๊ฐ ์คํจํด์ผ ํฉ๋๋ค. ์คํจํ ๋ฆด๋ ์ด ํตํฉ ํ
์คํธ์ด๊ธฐ ๋๋ฌธ์
๋๋ค.
๋ค์์ 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์ผ๋ก ์ ๋ฐ์ดํธํ๊ณ ์ถ์๋ฐ ์ด๋ป๊ฒ ํด์ผํ ์ง ๋ชจ๋ฅด๊ฒ ๋ค์...
์ฌ๊ธฐ์ ์ต์ Jest๊ฐ ์๋ ์์ ๋ฒ์ ์ด ์์ต๋๋ค. https://github.com/sibelius/relay-integration-test
์ด ๋ฌธ์ ํ์ ์์๋ด์ญ์์ค: https://github.com/facebook/jest/issues/2071
๋ฏธ๋์ ์ฐ๊ตฌ์์ ์ํด ์ฌ๊ธฐ ๋ด 5์ผํธ๊ฐ ์์ต๋๋ค. @sibelius ๋๋ถ์ ์ต์ Jest
์์๊ณ ์ฌ๊ธฐ https://github.com/GrigoryPtashko/jest-relay-integration-test์
๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@cpojer ์ด๊ฑฐ ์ข ๋ด์ฃผ์๊ฒ ์ด์ ? ์ ๋ง 14์์ 16์ผ๋ก ์ ๋ฐ์ดํธํ๊ณ ์ถ์๋ฐ ์ด๋ป๊ฒ ํด์ผํ ์ง ๋ชจ๋ฅด๊ฒ ๋ค์...