1

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?

Christian Baumann
3,7414 gold badges24 silver badges47 bronze badges
asked Jul 14 at 10:39

1 Answer 1

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

answered Jul 15 at 7:37
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.