Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@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
[5.0.1] - 2023-01-03
FAQs
Cucumber Tag Expression parser
The npm package @cucumber/tag-expressions receives a total of 682,156 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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.