Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@cucumber/tag-expressions
Advanced tools
@cucumber/tag-expressions is a package that allows you to evaluate tag expressions, which are commonly used in Cucumber to filter scenarios based on tags. This is useful for running specific subsets of tests based on tags.
Evaluate Simple Tag Expressions
This feature allows you to evaluate simple tag expressions to determine if a set of tags matches the expression. In this example, the expression '(@smoke or @regression) and not @wip' is parsed and evaluated against the tags ['@smoke'], resulting in true.
const { parse } = require('@cucumber/tag-expressions');
const expression = parse('(@smoke or @regression) and not @wip');
const matches = expression.evaluate(['@smoke']); // true
console.log(matches);
Evaluate Complex Tag Expressions
This feature allows you to evaluate more complex tag expressions. In this example, the expression '(@smoke and @fast) or (@regression and not @slow)' is parsed and evaluated against the tags ['@smoke', '@fast'], resulting in true.
const { parse } = require('@cucumber/tag-expressions');
const expression = parse('(@smoke and @fast) or (@regression and not @slow)');
const matches = expression.evaluate(['@smoke', '@fast']); // true
console.log(matches);
Evaluate Tag Expressions with Multiple Tags
This feature allows you to evaluate tag expressions against a set of multiple tags. In this example, the expression '@smoke and @fast' is parsed and evaluated against the tags ['@smoke', '@fast', '@ui'], resulting in true.
const { parse } = require('@cucumber/tag-expressions');
const expression = parse('@smoke and @fast');
const matches = expression.evaluate(['@smoke', '@fast', '@ui']); // true
console.log(matches);
The 'cucumber' package is a comprehensive tool for running BDD tests with Cucumber. It includes support for tag expressions, but also provides a full suite of tools for writing and running feature files, step definitions, and more. It is more feature-rich compared to @cucumber/tag-expressions, which focuses solely on tag expression evaluation.
The 'gherkin' package is used to parse Gherkin syntax, which is the language used for writing Cucumber feature files. While it does not directly evaluate tag expressions, it is often used in conjunction with tools like @cucumber/tag-expressions to filter and run specific scenarios based on tags.
The 'jest' package is a JavaScript testing framework that includes support for test filtering using tags. While it is not specifically designed for Cucumber-style tag expressions, it provides similar functionality for organizing and running tests based on tags.
import {TagExpressionParser} from '@cucumber/tag-expressions'
const parser = new TagExpressionParser()
const expressionNode = parser.parse('@tagA and @tagB')
expressionNode.evaluate(["@tagA", "@tagB"]) // => true
expressionNode.evaluate(["@tagA", "@tagC"]) // => false
FAQs
Cucumber Tag Expression parser
The npm package @cucumber/tag-expressions receives a total of 974,761 weekly downloads. As such, @cucumber/tag-expressions popularity was classified as popular.
We found that @cucumber/tag-expressions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.