Closed worldomonation closed 2 years ago
Hi @worldomonation.
I have just published a tiny update that adds this information to test files using environment variables. In your case you can check whether the process.env.JEST_GROUP_FEATUREA
is truthy:
/**
* @group FeatureA
* @group FeatureB
**/
describe('Test for Feature', function() {
const username = !! process.env.JEST_GROUP_FEATUREA ? 'featureAUser' : 'featureBUser';
});
Install the latest version of jest-runner-groups (2.2.0
) and let me know if it helps to solve your problem.
@eugene-manuilov I appreciate your really quick turnaround on this question!
I pulled 2.2.0 and tried it out and it works exactly like I would expect. Thank you!
Awesome! Gald it works.
Hi 👋 Thank you for an excellent plugin that solves a real problem for many folks.
I have a question about whether it's possible to tell (at a test file level) what group was specified when the command was given. The kind of problem I am attempting to solve is as follows:
In short, a test file may be shared between two or more groups that follow the same steps in order to reduce duplication in the test code. However, the test user to be used differ depending on the group selected.
Thanks and I appreciate any reply or pointers!