Socket
Socket
Sign inDemoInstall

@vitest/expect

Package Overview
Dependencies
Maintainers
3
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 1.0.0-beta.4 to 1.0.0-beta.5

1

dist/index.d.ts

@@ -61,2 +61,3 @@ import { stringify, Constructable } from '@vitest/utils';

interface MatcherState {
customTesters: Array<Tester>;
assertionCalls: number;

@@ -63,0 +64,0 @@ currentTestName?: string;

@@ -433,2 +433,3 @@ import { getColors, stringify, isObject, assertTypes } from '@vitest/utils';

isNot: this.inverse,
customTesters: [],
utils: {

@@ -852,2 +853,28 @@ ...getMatcherUtils(),

def("toContain", function(item) {
const actual = this._obj;
if (typeof Node !== "undefined" && actual instanceof Node) {
if (!(item instanceof Node))
throw new TypeError(`toContain() expected a DOM node as the argument, but got ${typeof item}`);
return this.assert(
actual.contains(item),
"expected #{this} to contain element #{exp}",
"expected #{this} not to contain element #{exp}",
item,
actual
);
}
if (typeof DOMTokenList !== "undefined" && actual instanceof DOMTokenList) {
assertTypes(item, "class name", ["string"]);
const isNot = utils.flag(this, "negate");
const expectedClassList = isNot ? actual.value.replace(item, "").trim() : `${actual.value} ${item}`;
return this.assert(
actual.contains(item),
`expected "${actual.value}" to contain "${item}"`,
`expected "${actual.value}" not to contain "${item}"`,
expectedClassList,
actual.value
);
}
if (actual != null && typeof actual !== "string")
utils.flag(this, "object", Array.from(actual));
return this.contain(item);

@@ -1337,2 +1364,3 @@ });

);
_error.cause = err;
_error.stack = error.stack.replace(error.message, _error.message);

@@ -1367,3 +1395,3 @@ throw _error;

`promise resolved "${utils.inspect(value)}" instead of rejecting`,
{ showDiff: false }
{ showDiff: true, expected: new Error("rejected promise"), actual: value }
);

@@ -1399,2 +1427,4 @@ _error.stack = error.stack.replace(error.message, _error.message);

...getState(expect),
// TODO: implement via expect.addEqualityTesters
customTesters: [],
isNot,

@@ -1401,0 +1431,0 @@ utils: jestUtils,

14

package.json
{
"name": "@vitest/expect",
"type": "module",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"description": "Jest's expect matchers as a Chai plugin",

@@ -21,3 +21,3 @@ "license": "MIT",

"types": "./index.d.ts",
"import": "./dist/index.js"
"default": "./dist/index.js"
},

@@ -30,9 +30,9 @@ "./*": "./*"

"files": [
"dist",
"*.d.ts"
"*.d.ts",
"dist"
],
"dependencies": {
"chai": "^4.3.10",
"@vitest/spy": "1.0.0-beta.4",
"@vitest/utils": "1.0.0-beta.4"
"@vitest/spy": "1.0.0-beta.5",
"@vitest/utils": "1.0.0-beta.5"
},

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

"rollup-plugin-copy": "^3.5.0",
"@vitest/runner": "1.0.0-beta.4"
"@vitest/runner": "1.0.0-beta.5"
},

@@ -46,0 +46,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