Socket
Socket
Sign inDemoInstall

@vitest/expect

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/expect - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

2

dist/index.d.ts

@@ -246,3 +246,3 @@ import * as tinyrainbow from 'tinyrainbow';

declare function getObjectKeys(object: object): Array<string | symbol>;
declare function getObjectSubset(object: any, subset: any, customTesters?: Array<Tester>): {
declare function getObjectSubset(object: any, subset: any, customTesters: Array<Tester>): {
subset: any;

@@ -249,0 +249,0 @@ stripped: number;

@@ -558,3 +558,3 @@ import { getType, stringify, isObject, assertTypes } from '@vitest/utils';

}
function getObjectSubset(object, subset, customTesters = []) {
function getObjectSubset(object, subset, customTesters) {
let stripped = 0;

@@ -580,2 +580,8 @@ const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {

seenReferences.set(object2, trimmed);
if (typeof object2.constructor === "function" && typeof object2.constructor.name === "string") {
Object.defineProperty(trimmed, "constructor", {
enumerable: false,
value: object2.constructor
});
}
for (const key of getObjectKeys(object2)) {

@@ -921,5 +927,6 @@ if (hasPropertyInObject(subset2, key)) {

}
function wrapSoft(utils, fn) {
function wrapAssertion(utils, name, fn) {
return function(...args) {
var _a;
utils.flag(this, "_name", name);
if (!utils.flag(this, "soft")) {

@@ -948,3 +955,3 @@ return fn.apply(this, args);

const addMethod = (n) => {
const softWrapper = wrapSoft(utils, fn);
const softWrapper = wrapAssertion(utils, n, fn);
utils.addMethod(chai.Assertion.prototype, n, softWrapper);

@@ -1075,3 +1082,4 @@ utils.addMethod(

actual,
expected
expected,
customTesters
);

@@ -1171,4 +1179,4 @@ if (pass && isNot || !pass && !isNot) {

"expected #{this} to not be truthy",
obj,
false
true,
obj
);

@@ -1182,4 +1190,4 @@ });

"expected #{this} to not be falsy",
obj,
false
false,
obj
);

@@ -1195,4 +1203,4 @@ });

`expected ${actual} to be not greater than ${expected}`,
expected,
actual,
expected,
false

@@ -1209,4 +1217,4 @@ );

`expected ${actual} to be not greater than or equal to ${expected}`,
expected,
actual,
expected,
false

@@ -1223,4 +1231,4 @@ );

`expected ${actual} to be not less than ${expected}`,
expected,
actual,
expected,
false

@@ -1237,4 +1245,4 @@ );

`expected ${actual} to be not less than or equal to ${expected}`,
expected,
actual,
expected,
false

@@ -1244,9 +1252,30 @@ );

def("toBeNaN", function() {
return this.be.NaN;
const obj = utils.flag(this, "object");
this.assert(
Number.isNaN(obj),
"expected #{this} to be NaN",
"expected #{this} not to be NaN",
Number.NaN,
obj
);
});
def("toBeUndefined", function() {
return this.be.undefined;
const obj = utils.flag(this, "object");
this.assert(
void 0 === obj,
"expected #{this} to be undefined",
"expected #{this} not to be undefined",
void 0,
obj
);
});
def("toBeNull", function() {
return this.be.null;
const obj = utils.flag(this, "object");
this.assert(
obj === null,
"expected #{this} to be null",
"expected #{this} not to be null",
null,
obj
);
});

@@ -1928,3 +1957,3 @@ def("toBeDefined", function() {

}
const softWrapper = wrapSoft(utils, expectWrapper);
const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper);
utils.addMethod(

@@ -1931,0 +1960,0 @@ globalThis[JEST_MATCHERS_OBJECT].matchers,

{
"name": "@vitest/expect",
"type": "module",
"version": "2.1.2",
"version": "2.1.3",
"description": "Jest's expect matchers as a Chai plugin",

@@ -35,4 +35,4 @@ "license": "MIT",

"tinyrainbow": "^1.2.0",
"@vitest/spy": "2.1.2",
"@vitest/utils": "2.1.2"
"@vitest/spy": "2.1.3",
"@vitest/utils": "2.1.3"
},

@@ -42,3 +42,3 @@ "devDependencies": {

"rollup-plugin-copy": "^3.5.0",
"@vitest/runner": "2.1.2"
"@vitest/runner": "2.1.3"
},

@@ -45,0 +45,0 @@ "scripts": {

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