Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-matcher-utils

Package Overview
Dependencies
Maintainers
3
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-matcher-utils - npm Package Compare versions

Comparing version 14.0.0 to 14.2.0-alpha.ca8bfb6e

120

build/index.js

@@ -19,25 +19,25 @@ /**

if (typeof value === 'undefined') {
return 'undefined';} else
if (value === null) {
return 'null';} else
if (Array.isArray(value)) {
return 'array';} else
if (typeof value === 'boolean') {
return 'boolean';} else
if (typeof value === 'function') {
return 'function';} else
if (typeof value === 'number') {
return 'number';} else
if (typeof value === 'string') {
return 'string';} else
if (typeof value === 'object') {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Array.isArray(value)) {
return 'array';
} else if (typeof value === 'boolean') {
return 'boolean';
} else if (typeof value === 'function') {
return 'function';
} else if (typeof value === 'number') {
return 'number';
} else if (typeof value === 'string') {
return 'string';
} else if (typeof value === 'object') {
return 'object';
// $FlowFixMe https://github.com/facebook/flow/issues/1015
} else if (typeof value === 'symbol') {
return 'symbol';}
return 'symbol';
}
throw new Error(`value of unknown type: ${ value }`);
};
throw new Error(`value of unknown type: ${ value }`);};
// Convert to JSON removing circular references and

@@ -50,38 +50,38 @@ // converting JS values to strings.

if (
value &&
value.constructor &&
value.constructor.name === 'RegExp')
value &&
value.constructor &&
value.constructor.name === 'RegExp')
{
return value.toString();} else
{
return value.toString();
} else {
if (set.has(value)) {
return '[Circular]';}
set.add(value);}} else
if (typeof value === 'function') {
return value.toString();} else
if (typeof value === 'undefined') {
return '[Circular]';
}
set.add(value);
}
} else if (typeof value === 'function') {
return value.toString();
} else if (typeof value === 'undefined') {
return 'undefined';
// $FlowFixMe symbols are not supported by flow yet
} else if (typeof value === 'symbol') {
return value.toString();} else
if (value === Infinity) {
return 'Infinity';} else
if (value === -Infinity) {
return '-Infinity';} else
if (Number.isNaN(value)) {
return 'NaN';}
return value.toString();
} else if (value === Infinity) {
return 'Infinity';
} else if (value === -Infinity) {
return '-Infinity';
} else if (Number.isNaN(value)) {
return 'NaN';
}
return value;
});
};
return value;});};
const ensureNoExpected = (expected, matcherName) => {
matcherName || (matcherName = 'This');
if (typeof expected !== 'undefined') {
throw new Error(`${ matcherName } matcher does not accept any arguments`);}};
throw new Error(`${ matcherName } matcher does not accept any arguments`);
}
};
const ensureActualIsNumber = (actual, matcherName) => {

@@ -91,8 +91,8 @@ matcherName || (matcherName = 'This matcher');

throw new Error(
`${ matcherName } actual value should be a number. ` +
`'${ typeof actual }' was passed`);}};
`${ matcherName } actual value should be a number. ` +
`'${ typeof actual }' was passed`);
}
};
const ensureExpectedIsNumber = (expected, matcherName) => {

@@ -102,19 +102,19 @@ matcherName || (matcherName = 'This matcher');

throw new Error(
`${ matcherName } expected value should be a number. ` +
`'${ typeof expected }' was passed`);}};
`${ matcherName } expected value should be a number. ` +
`'${ typeof expected }' was passed`);
}
};
const ensureNumbers = (actual, expected, matcherName) => {
ensureActualIsNumber(actual, matcherName);
ensureExpectedIsNumber(expected, matcherName);};
ensureExpectedIsNumber(expected, matcherName);
};
module.exports = {
getType,
stringify,
ensureNoExpected,
ensureActualIsNumber,
ensureExpectedIsNumber,
module.exports = {
getType,
stringify,
ensureNoExpected,
ensureActualIsNumber,
ensureExpectedIsNumber,
ensureNumbers };
{
"name": "jest-matcher-utils",
"description": "A set of utility functions for jest-matchers and related packages",
"version": "14.0.0",
"version": "14.2.0-alpha.ca8bfb6e",
"repository": {

@@ -11,7 +11,2 @@ "type": "git",

"main": "build/index.js",
"jest": {
"rootDir": "./src",
"scriptPreprocessor": "../../babel-jest",
"testEnvironment": "node"
},
"scripts": {

@@ -18,0 +13,0 @@ "test": "../../packages/jest-cli/bin/jest.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc