jest-editor-support
jest-editor-support copied to clipboard
Support additional `describe` aliases
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: https://github.com/facebook/jest/issues/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.
looks like "context" was removed explicitly (facebook/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...
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.