
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
@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
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.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.