Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests break after upgrade to jest 20.0.0 from 19.0.2 #3505

Closed
presidenten opened this issue May 7, 2017 · 4 comments · Fixed by #3506
Closed

Tests break after upgrade to jest 20.0.0 from 19.0.2 #3505

presidenten opened this issue May 7, 2017 · 4 comments · Fixed by #3506

Comments

@presidenten
Copy link

presidenten commented May 7, 2017

Running jest 20.0.0, fresh node_modules and --no-cache

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Tests run fine and show correct behaviour with jest 19.0.2, but break in 20.0.0.
Running test with fit or it.only makes the test pass again.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

git clone https://github.com/presidenten/vuex-plus.git
cd vuex-plus
yarn

 node_modules/.bin/jest --config=.jestrc.json --no-cache src/api/map.spec.js
# "should return local getters" test passes

yarn upgrade jest@^20.0.0 babel-jest@^20.0.0
node_modules/.bin/jest --config=.jestrc.json --no-cache src/api/map.spec.js
#  get same issue as https://github.com/facebook/jest/issues/3499

nano .jestrc.json
# change "<rootDir>/src/**/?(*.)(spec).js?(x)" to "**/?(*.)(spec).js?(x)", save & exit

node_modules/.bin/jest --config=.jestrc.json --no-cache src/api/map.spec.js
# "should return local getters" test fails

nano +57 src/api/map.spec.js
# change `it` to `fit`, save & exit

 node_modules/.bin/jest --config=.jestrc.json --no-cache src/api/map.spec.js
# "should return local getters" test passes

What is the expected behavior?
Tests passing in 19.0.2 should continue to work in 20.0.0, also running tests with or without fit should not make a difference to whether the test passes or not.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest config:

{
  "bail": true,
  "testMatch": [
    "<rootDir>/src/**/?(*.)(spec).js?(x)"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "vue"
  ],
  "clearMocks": true,
  "resetMocks": true,
  "resetModules": true
}

node version 6.9.1
yarn version 0.17.10
osx 10.12.4

@thymikee
Copy link
Collaborator

thymikee commented May 7, 2017

Looks like a regression after rewriting our Jasmine bindings.
As a workaround for now, don't use this in your tests or reset the values. It currently gets shared between functions in the same describe block, so your this.instance = 'bar' set in first test is preserved in a following one, where you assume it to be empty (that's why it pass as a single test).

@presidenten
Copy link
Author

Rewriting the tests to pass an object to xyz.call() instead of passing this, solved the problem.

@thymikee
Copy link
Collaborator

thymikee commented May 8, 2017

Closing, we'll discuss this in relevant PR.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants