-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Why was context removed in a point release? #2468
Comments
Context was controversial when it was added in #1632. We are currently rewriting the documentation of Jest and were analyzing the globals we add and realized context was almost entirely unused so we decided to remove this alias again. If you'd like to bring it back, you can do As to why this happened in a minor, here is what happened:
|
@cpojer Thanks for the response. First, let me apologize for the tone of my original issue. I didn't spend enough time on it, and it came across sounding much harsher than I intended. I'm also sorry that you had to give up some vacation time to deal with an issue caused by someone else's change. I really appreciate the work you all have done on this project. It's because of that work that I'm even looking at Jest as an option. I had thought about the That said, I understand your reasoning for dropping it, though I disagree. And I understand the unfortunate circumstances that resulted in that happening on a point release. I'm not a big fan of multiple release tracks, so I wouldn't suggest you make your process more complicated than it is. Again, thanks everyone for your work on the project! |
Thanks for your response. ❤️ |
@cpojer re: I've done this in several node projects, however, for the life of me I can't get it to work with vscode in a project where the test files are typescript (using ts-jest). The tests run fine if I add a declaration file and wire it up properly for use in tsconfig's The only way I've been able to get this to go away is to create a ts file (which must be open in the editor at all times) that is added to Thanks in advance. |
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. |
Do you want to request a feature or report a bug?
Question/Feature
What is the current behavior?
I have a test suite that was working fine with Jest 18.0. When I upgraded to Jest 18.1, many of my tests started failing with the message, "ReferenceError: context is not defined".
It appears that
context
was removed as a synonym ofdescribe
in #2384, but no reasoning was given there, other than that it was "unused".It seems like such a breaking change should not have been introduced in a point release.
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
andyarn test
.What is the expected behavior?
My understanding was that
context
was provided as an alias fordescribe
to make it easier to port tests from other frameworks to Jest. Certainly, this is the case for us, as we've been migrating several projects from Mocha to Jest recently.In many situations, I find
context
to communicate my intentions better thandescribe
, so I really like having the alias.I would like to see the
context
alias restored and documented as part of Jest's API. To me, it is similar to havingit
andtest
as aliases of each other.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 18.1.0
Yarn 0.18.1
Node 6.9.2
OS/X 10.11.6
The text was updated successfully, but these errors were encountered: