Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
core-assert
Advanced tools
The core-assert npm package provides a set of assertion functions for verifying invariants in your code. It is commonly used in testing to ensure that code behaves as expected.
assert.ok
The assert.ok function tests if a value is truthy. If the value is not truthy, it throws an AssertionError.
const assert = require('core-assert');
assert.ok(true); // No error
assert.ok(false); // Throws an AssertionError
assert.equal
The assert.equal function tests shallow, coercive equality between two values using the == operator. If the values are not equal, it throws an AssertionError.
const assert = require('core-assert');
assert.equal(1, 1); // No error
assert.equal(1, 2); // Throws an AssertionError
assert.deepEqual
The assert.deepEqual function tests for deep equality between two objects. If the objects are not deeply equal, it throws an AssertionError.
const assert = require('core-assert');
assert.deepEqual({a: 1}, {a: 1}); // No error
assert.deepEqual({a: 1}, {a: 2}); // Throws an AssertionError
assert.throws
The assert.throws function tests if a function throws an error. If the function does not throw an error, it throws an AssertionError.
const assert = require('core-assert');
assert.throws(() => { throw new Error('error'); }, Error); // No error
assert.throws(() => { }, Error); // Throws an AssertionError
Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It provides a more expressive and readable syntax compared to core-assert.
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It provides built-in assertion functions and is often used for testing React applications. It offers more features and integrations compared to core-assert.
Should is an expressive, readable, framework-agnostic assertion library. It extends Object.prototype to provide a more natural language style for assertions, making tests more readable compared to core-assert.
I don't have time or interest in keeping it in sync with Node.js anymore. It should continue to work fine though. It's just missing some improvements from later Node.js versions.
Useful to ensure consistency between Node.js versions as the assert
module has changed a lot.
Lets you use the Node.js 4.0 assert.deepStrictEqual()
/assert.notDeepStrictEqual()
methods all the way back to Node.js 0.10.
Issues and improvements should be done in Node.js first.
$ npm install --save core-assert
var assert = require('core-assert');
assert.strictEqual('unicorn', 'unicorn');
assert.deepStrictEqual()
algorithm as a standalone moduleMIT © Sindre Sorhus
FAQs
Node.js `assert` as a standalone module
The npm package core-assert receives a total of 94,799 weekly downloads. As such, core-assert popularity was classified as popular.
We found that core-assert demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.