Jest: Jest 16 (and actually Jest 15 also) does not do Relay integration test correctly but Jest 14 does it correctly

Created on 8 Oct 2016  ·  3Comments  ·  Source: facebook/jest

Do you want to request a _feature_ or report a _bug_?

A bug.

What is the current behavior?

The test that knowingly fails is reported by Jest 16 as passed. Jest 14 correctly fails the test.

Here's the output of Jest 16 (see the output for Jest 14 lower):

$ 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.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

Here's the repo for the repro.

https://github.com/GrigoryPtashko/jest-relay-integration-test

master branch with jest 16

jest14 branch with jest 14

Just clone it, npm install and you'll see everything yourself. Use branches to switch between Jest versions.

What is the expected behavior?

The expected behavior - the test in the repro must fail. Because it is a failing Relay integration test.
Here's the correct output from 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.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

$ 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.

Most helpful comment

@cpojer could you take a look at this one? I really want to update to 16 from 14. But I don't know how...

All 3 comments

@cpojer could you take a look at this one? I really want to update to 16 from 14. But I don't know how...

I have a working version with latest Jest here: https://github.com/sibelius/relay-integration-test

figure it out after this issue: https://github.com/facebook/jest/issues/2071

For future researchers here are my 5 cents. Thanks to @sibelius I've got it working with the latest Jest and here it is https://github.com/GrigoryPtashko/jest-relay-integration-test.

Was this page helpful?
0 / 5 - 0 ratings