Jest: Jest 16(๋ฐ ์‹ค์ œ๋กœ Jest 15๋„)์€ Relay ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š์ง€๋งŒ Jest 14๋Š” ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2016๋…„ 10์›” 08์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: facebook/jest

_๊ธฐ๋Šฅ_์„ ์š”์ฒญํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ? ์•„๋‹ˆ๋ฉด _๋ฒ„๊ทธ_๋ฅผ ๋ณด๊ณ ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?

๋ฒ„๊ทธ.

ํ˜„์žฌ ํ–‰๋™์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?

๊ณ ์˜๋กœ ์‹คํŒจํ•œ ํ…Œ์ŠคํŠธ๋Š” 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์œผ๋กœ ์—…๋ฐ์ดํŠธํ•˜๊ณ  ์‹ถ์€๋ฐ ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ์ง€ ๋ชจ๋ฅด๊ฒ ๋„ค์š”...

๋ชจ๋“  3 ๋Œ“๊ธ€

@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์ž…๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰