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

Support additional describe aliases #73

Open
blimmer opened this issue May 28, 2021 · 2 comments
Open

Support additional describe aliases #73

blimmer opened this issue May 28, 2021 · 2 comments

Comments

@blimmer
Copy link

blimmer commented May 28, 2021

Would you consider support for identifying describe aliases (like context)? I've got a client that sets global.context = describe so they can write tests like:

describe('some method', () => {
  context('when something is true', () => {
     beforeEach(() => {
       // make 'something' true
     });
     it('does things', () => {
       // test
     });
  });
});

This used to be a jest feature, and it seems like some folks are still using this global trick like they are: jestjs/jest#2468.

Sadly, because they use context, it breaks a vs-code plugin I use (https://github.com/firsttris/vscode-jest-runner) because only describe blocks are identified by this package.

@connectdotz
Copy link
Collaborator

looks like "context" was removed explicitly (jestjs/jest#2468). Supporting it here is not hard, but it might be in users' best interest to move on from context and adopt the officially supported standard...

@blimmer
Copy link
Author

blimmer commented May 30, 2021

Yep, I saw that they removed context a while back. I think context is a useful semantic alias to use and other frameworks (like Mocha, RSpec, etc.) support its usage.

Support in this plugin would be super-nice because it would allow configuring the behavior that best suits their team's testing best practices. I would expect it wouldn't be a default behavior, so most users wouldn't notice the change in this repo. However, I also understand if you prefer to keep this project focused on the officially-supported behaviors of `jest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants