Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cucumber-tag-expressions
Advanced tools
The cucumber-tag-expressions npm package is used to evaluate tag expressions in Cucumber. It allows you to filter scenarios based on tags, enabling you to run specific subsets of tests. This is particularly useful for managing large test suites and running only relevant tests based on certain conditions.
Parsing Tag Expressions
This feature allows you to parse tag expressions and evaluate them against a set of tags. The example demonstrates how to parse a complex tag expression and evaluate it against different sets of tags.
const TagExpressionParser = require('cucumber-tag-expressions').TagExpressionParser;
const parser = new TagExpressionParser();
const expressionNode = parser.parse('(@smoke or @regression) and not @wip');
console.log(expressionNode.evaluate(['@smoke'])); // true
console.log(expressionNode.evaluate(['@wip'])); // false
Combining Tag Expressions
This feature allows you to combine multiple tag expressions using logical operators like AND, OR, and NOT. The example shows how to combine two tag expressions and evaluate the combined expression.
const TagExpressionParser = require('cucumber-tag-expressions').TagExpressionParser;
const parser = new TagExpressionParser();
const expressionNode1 = parser.parse('@smoke');
const expressionNode2 = parser.parse('@regression');
const combinedExpression = expressionNode1.and(expressionNode2);
console.log(combinedExpression.evaluate(['@smoke', '@regression'])); // true
console.log(combinedExpression.evaluate(['@smoke'])); // false
Simplifying Tag Expressions
This feature allows you to simplify complex tag expressions. The example demonstrates how to parse a complex tag expression and then simplify it.
const TagExpressionParser = require('cucumber-tag-expressions').TagExpressionParser;
const parser = new TagExpressionParser();
const expressionNode = parser.parse('(@smoke or @regression) and not @wip');
const simplifiedExpression = expressionNode.simplify();
console.log(simplifiedExpression.toString()); // '(@smoke or @regression) and not @wip'
The cucumber package is a comprehensive tool for running Cucumber tests. It includes functionality for defining and running feature files, step definitions, and hooks. While it also supports tag expressions, it is a much larger package with a broader scope compared to cucumber-tag-expressions.
The gherkin package is used for parsing Gherkin syntax, which is the language used for writing Cucumber feature files. It includes functionality for parsing feature files and extracting scenarios and steps. While it does not focus on tag expressions, it is often used in conjunction with Cucumber and related tools.
The jest-cucumber package integrates Cucumber-style testing with the Jest testing framework. It allows you to write feature files and step definitions using Jest. While it supports tagging scenarios, its primary focus is on integrating Cucumber with Jest rather than evaluating tag expressions.
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 not healthy version release cadence and project activity because the last version was released 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.