Socket
Socket
Sign inDemoInstall

expect

Package Overview
Dependencies
Maintainers
7
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect - npm Package Compare versions

Comparing version 21.3.0-beta.8 to 21.3.0-beta.9

27

build/index.js

@@ -25,2 +25,4 @@ 'use strict';

var _to_throw_matchers = require('./to_throw_matchers');var _to_throw_matchers2 = _interopRequireDefault(_to_throw_matchers);
var _jasmine_utils = require('./jasmine_utils');

@@ -55,2 +57,9 @@ var _asymmetric_matchers = require('./asymmetric_matchers');

const getPromiseMatcher = name => {
if (name === 'toThrow' || name === 'toThrowError') {
return (0, _to_throw_matchers.createMatcher)('.' + name, true);
}
return null;
};
const expect = function (actual) {

@@ -69,12 +78,10 @@ if ((arguments.length <= 1 ? 0 : arguments.length - 1) !== 0) {

Object.keys(allMatchers).forEach(name => {
expectation[name] = makeThrowingMatcher(allMatchers[name], false, actual);
expectation.not[name] = makeThrowingMatcher(
allMatchers[name],
true,
actual);
const matcher = allMatchers[name];
const promiseMatcher = getPromiseMatcher(name) || matcher;
expectation[name] = makeThrowingMatcher(matcher, false, actual);
expectation.not[name] = makeThrowingMatcher(matcher, true, actual);
expectation.resolves[name] = makeResolveMatcher(
name,
allMatchers[name],
promiseMatcher,
false,

@@ -85,3 +92,3 @@ actual);

name,
allMatchers[name],
promiseMatcher,
true,

@@ -93,3 +100,3 @@ actual);

name,
allMatchers[name],
promiseMatcher,
false,

@@ -100,3 +107,3 @@ actual);

name,
allMatchers[name],
matcher,
true,

@@ -103,0 +110,0 @@ actual);

@@ -43,3 +43,3 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });

toBe(received, expected) {
const pass = received === expected;
const pass = Object.is(received, expected);

@@ -50,3 +50,3 @@ const message = pass ?

'\n\n' +
`Expected value to not be (using ===):\n` +
`Expected value to not be (using Object.is):\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +

@@ -68,3 +68,3 @@ `Received:\n` +

'\n\n' +
`Expected value to be (using ===):\n` +
`Expected value to be (using Object.is):\n` +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +

@@ -71,0 +71,0 @@ `Received:\n` +

@@ -1,2 +0,2 @@

'use strict';Object.defineProperty(exports, "__esModule", { value: true });
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.createMatcher = undefined;

@@ -29,19 +29,22 @@

*
*/const createMatcher = matcherName => (actual, expected) => {const value = expected;let error;
*/const createMatcher = exports.createMatcher = (matcherName, fromPromise) => (actual, expected) => {const value = expected;let error;
if (typeof actual !== 'function') {
throw new Error(
(0, _jestMatcherUtils.matcherHint)(matcherName, 'function', (0, _jestGetType2.default)(value)) +
'\n\n' +
'Received value must be a function, but instead ' +
`"${(0, _jestGetType2.default)(actual)}" was found`);
if (fromPromise) {
error = actual;
} else {
if (typeof actual !== 'function') {
throw new Error(
(0, _jestMatcherUtils.matcherHint)(matcherName, 'function', (0, _jestGetType2.default)(value)) +
'\n\n' +
'Received value must be a function, but instead ' +
`"${(0, _jestGetType2.default)(actual)}" was found`);
}
try {
actual();
} catch (e) {
error = e;
}
}
try {
actual();
} catch (e) {
error = e;
}
if (typeof expected === 'string') {

@@ -48,0 +51,0 @@ expected = new RegExp((0, _jestRegexUtil.escapeStrForRegex)(expected));

{
"name": "expect",
"version": "21.3.0-beta.8",
"version": "21.3.0-beta.9",
"repository": {

@@ -13,8 +13,8 @@ "type": "git",

"ansi-styles": "^3.2.0",
"jest-diff": "21.3.0-beta.8",
"jest-get-type": "21.3.0-beta.8",
"jest-matcher-utils": "21.3.0-beta.8",
"jest-message-util": "21.3.0-beta.8",
"jest-diff": "21.3.0-beta.9",
"jest-get-type": "21.3.0-beta.9",
"jest-matcher-utils": "21.3.0-beta.9",
"jest-message-util": "21.3.0-beta.9",
"jest-regex-util": "^21.2.0"
}
}

Sorry, the diff of this file is too big to display

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