-
Notifications
You must be signed in to change notification settings - Fork 242
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
[no-standalone-expect] allow specifying what to consider a test block via an option #354
Comments
If you're using jest-each and jest >=22, see this answer. |
I'd like to see this too, since I've extended the describe.each and it.each functions with some additional properties. |
Just run into a situation where this would be really helpful: In the project that I'm working on, we are leveraging Next.js's environment variables feature to control the app's behavior, and we are trying to create unit tests coverage for those behaviors. Essentially we are doing something like: // test-utils.js
export const testIfA = process.env.MY_VAR === 'A' ? test : test.skip;
export const testIfB = process.env.MY_VAR === 'B' ? test : test.skip;
// others...
// myCode.test.js
import { testIfA, testIfB } from './test-utils.js';
describe('My tests', () => {
testIfA('Only when A', () => {
// test A behavior
});
testIfB('Only when B', () => {
// test B behavior
});
}); And |
🎉 This issue has been resolved in version 23.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is pretty much the equivalent of
expect-expect
'sassertFunctionNames
option: We should support consuming an array of arbitrary strings of which we should consider as "test blocks".This would allow extensions to work nicely with this rule, such as
jest-each
.It's probably best to just to make the default value the current blocks we test for, in the same way
expect-expect
hasexpect
as it's default.The text was updated successfully, but these errors were encountered: