
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
cucumber-assert
Advanced tools
An assertion library for cucumber.js providing cucumber compatible failures instead of exceptions
An assertion library for cucumber.js. It allows assertions in cucumber.js without extra-long stacktraces when an assertion fails.
npm install cucumber-assert
As of Version 2.0, cucumber-assert uses Promises. If you need the old version without Promises, install Version 1.0.4:
npm install cucumber-assert@1.0.4
var assert = require('cucumber-assert');
module.exports = function() {
this.Given(/^the field E-Mail is filled with "([^"]*)"/, function (email, callback) {
var fieldValue = this.getFieldValue('#password');
assert.equal(fieldValue, email, 'Expected E-Mail to be ' + email).then(callback, callback);
});
}
If you need multiple assertions in one step, you can simply wait to resolve all the Promises. Since Promise.all() will resolve with an array of the results, Promise.all(...).then(callback) would result in a broken test, since calling the callback with a parameter tells cucumber, that something went wrong. You can either use Promise.all(...).then(() => callback()) or the provided .all() Method:
var assert = require('cucumber-assert');
module.exports = function() {
this.Given(/^the form is filled out"/, function (callback) {
var password = this.getFieldValue('#password');
var name = this.getFieldValue('#name');
var tosCheck = this.getFieldValue('#tos');
var promises = [];
promises.push(assert.notEqual(password, '', 'Expected E-Mail to not be empty'));
promises.push(assert.notEqual(tosCheck, '', 'Expected Name not to be empty'));
promises.push(assert.equal(tosCheck, 'checked', 'Expected TOS to be checked'));
assert.all(promises).then(callback, callback);
});
}
instead of
Promise.all(promises).then(() => callback(), () => callback());
Generally cucumber-assert wraps the assertions available by default in node. For reference see http://nodejs.org/api/assert.html
The parameter "callback" is the callback provided by cucumber.js in step definitions and has to be passed always alongside the actual values and expectations.
assert.equal(password, '', 'Expected E-Mail to be empty').then(callback);
assert.notEqual(password, '', 'Expected E-Mail not to be empty').then(callback);
assert.deepEqual(nestedObject, expectedNestedObject).then(callback);
assert.notDeepEqual(nestedObject, notExpectedNestedObject).then(callback);
assert.strictEqual(1, 1).then(callback);
assert.notStrictEqual(1, "1").then(callback);
assert.throws(someFunctionThatThrows).then(callback);
assert.doesNotThrow(someFunctionThatDoesNotThrow).then(callback);
assert.ifError(failsIfThisIsTrue).then(callback);
FAQs
An assertion library for cucumber.js providing cucumber compatible failures instead of exceptions
The npm package cucumber-assert receives a total of 1,540 weekly downloads. As such, cucumber-assert popularity was classified as popular.
We found that cucumber-assert demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.