I have scenarios in my cucumber feature file with a tag labeled as @skipTest, and I want to skip all the tests in this file using the before hooks. The reason I want to do this is that in the local environment, I want to skip all the tests but the test will run in the production environment.
Below is my code snippet in the hook file
Before({ tags: '@skipTest' }, function (this: CustomWorld) {
if (isLocalEnvironment()) {
return this.skip();
}
});
How can I skip the scenarios that use the tag?
1 Answer 1
I was able to resolve this by adding the script to my package.json file
"cucumber-js --tags 'not @skipTest' --config=cucumber.js || true"
So when I run npm run test It runs all my tests except the one tag as skipTest
Comments
Explore related questions
See similar questions with these tags.