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

@tapjs/asserts

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/asserts - npm Package Compare versions

Comparing version 0.0.0-9 to 0.0.0-10

29

dist/cjs/index.d.ts

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

/// <reference types="node" />
/// <reference types="node" resolution-mode="require"/>
import { Extra, MessageExtra, TapPlugin, TestBase } from '@tapjs/core';

@@ -117,2 +117,29 @@ import EventEmitter from 'events';

/**
* Verify that the value matches the pattern provided, with no
* extra properties.
*/
matchOnlyStrict(found: any, wanted: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value does not match the pattern provided, with no
* extra properties. Ie, it might either not match, or have extra props.
*/
notMatchOnlyStrict(found: any, doNotWant: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value matches the pattern provided, but fail if any
* fields *only* match via type coercion.
*
* For example,
*
* ```ts
* t.matchStrict({ a: 1 }, { a: Number }, 'this passes')
* t.matchStrict({ a: 1 }, { a: '1' }, 'this fails')
* ```
*/
matchStrict(found: any, wanted: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value does not match the pattern provided, without
* type coercion.
*/
notMatchStrict(found: any, doNotWant: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the object has the wanted property, anywhere in its

@@ -119,0 +146,0 @@ * prototype chain.

@@ -362,2 +362,65 @@ "use strict";

/**
* Verify that the value matches the pattern provided, with no
* extra properties.
*/
matchOnlyStrict(found, wanted, ...[msg, extra]) {
// this.#t.currentAssert = this.#t.t.matchOnlyStrict
const args = [msg, extra];
const me = (0, core_1.normalizeMessageExtra)('should match pattern', args);
const { match: ok, diff } = (0, tcompare_1.matchOnlyStrict)(found, wanted, this.#opts);
if (ok)
return this.#t.pass(...me);
Object.assign(me[1], { diff });
return this.#t.fail(...me);
}
/**
* Verify that the value does not match the pattern provided, with no
* extra properties. Ie, it might either not match, or have extra props.
*/
notMatchOnlyStrict(found, doNotWant, ...[msg, extra]) {
// this.#t.currentAssert = this.#t.t.notMatchOnlyStrict
const args = [msg, extra];
const me = (0, core_1.normalizeMessageExtra)('should not match pattern', args);
const { match: ok } = (0, tcompare_1.matchOnlyStrict)(found, doNotWant, this.#opts);
if (!ok)
return this.#t.pass(...me);
Object.assign(me[1], { found, doNotWant });
return this.#t.fail(...me);
}
/**
* Verify that the value matches the pattern provided, but fail if any
* fields *only* match via type coercion.
*
* For example,
*
* ```ts
* t.matchStrict({ a: 1 }, { a: Number }, 'this passes')
* t.matchStrict({ a: 1 }, { a: '1' }, 'this fails')
* ```
*/
matchStrict(found, wanted, ...[msg, extra]) {
this.#t.currentAssert = this.#t.t.matchStrict;
const args = [msg, extra];
const me = (0, core_1.normalizeMessageExtra)('should match pattern', args);
const { match: ok, diff } = (0, tcompare_1.matchStrict)(found, wanted, this.#opts);
if (ok)
return this.#t.pass(...me);
Object.assign(me[1], { diff });
return this.#t.fail(...me);
}
/**
* Verify that the value does not match the pattern provided, without
* type coercion.
*/
notMatchStrict(found, doNotWant, ...[msg, extra]) {
this.#t.currentAssert = this.#t.t.notMatchStrict;
const args = [msg, extra];
const me = (0, core_1.normalizeMessageExtra)('should not match pattern', args);
const { match: ok } = (0, tcompare_1.matchStrict)(found, doNotWant, this.#opts);
if (!ok)
return this.#t.pass(...me);
Object.assign(me[1], { found, doNotWant });
return this.#t.fail(...me);
}
/**
* Verify that the object has the wanted property, anywhere in its

@@ -364,0 +427,0 @@ * prototype chain.

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

/// <reference types="node" />
/// <reference types="node" resolution-mode="require"/>
import { Extra, MessageExtra, TapPlugin, TestBase } from '@tapjs/core';

@@ -117,2 +117,29 @@ import EventEmitter from 'events';

/**
* Verify that the value matches the pattern provided, with no
* extra properties.
*/
matchOnlyStrict(found: any, wanted: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value does not match the pattern provided, with no
* extra properties. Ie, it might either not match, or have extra props.
*/
notMatchOnlyStrict(found: any, doNotWant: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value matches the pattern provided, but fail if any
* fields *only* match via type coercion.
*
* For example,
*
* ```ts
* t.matchStrict({ a: 1 }, { a: Number }, 'this passes')
* t.matchStrict({ a: 1 }, { a: '1' }, 'this fails')
* ```
*/
matchStrict(found: any, wanted: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the value does not match the pattern provided, without
* type coercion.
*/
notMatchStrict(found: any, doNotWant: any, ...[msg, extra]: MessageExtra): boolean;
/**
* Verify that the object has the wanted property, anywhere in its

@@ -119,0 +146,0 @@ * prototype chain.

@@ -5,3 +5,3 @@ import { normalizeMessageExtra, } from '@tapjs/core';

import { isPromise } from 'is-actual-promise';
import { has, hasStrict, match, matchOnly, same, strict, } from 'tcompare';
import { has, hasStrict, match, matchOnly, matchOnlyStrict, matchStrict, same, strict, } from 'tcompare';
import { Deferred } from 'trivial-deferred';

@@ -334,2 +334,65 @@ import { normalizeThrowsArgs } from './normalize-throws-args.js';

/**
* Verify that the value matches the pattern provided, with no
* extra properties.
*/
matchOnlyStrict(found, wanted, ...[msg, extra]) {
// this.#t.currentAssert = this.#t.t.matchOnlyStrict
const args = [msg, extra];
const me = normalizeMessageExtra('should match pattern', args);
const { match: ok, diff } = matchOnlyStrict(found, wanted, this.#opts);
if (ok)
return this.#t.pass(...me);
Object.assign(me[1], { diff });
return this.#t.fail(...me);
}
/**
* Verify that the value does not match the pattern provided, with no
* extra properties. Ie, it might either not match, or have extra props.
*/
notMatchOnlyStrict(found, doNotWant, ...[msg, extra]) {
// this.#t.currentAssert = this.#t.t.notMatchOnlyStrict
const args = [msg, extra];
const me = normalizeMessageExtra('should not match pattern', args);
const { match: ok } = matchOnlyStrict(found, doNotWant, this.#opts);
if (!ok)
return this.#t.pass(...me);
Object.assign(me[1], { found, doNotWant });
return this.#t.fail(...me);
}
/**
* Verify that the value matches the pattern provided, but fail if any
* fields *only* match via type coercion.
*
* For example,
*
* ```ts
* t.matchStrict({ a: 1 }, { a: Number }, 'this passes')
* t.matchStrict({ a: 1 }, { a: '1' }, 'this fails')
* ```
*/
matchStrict(found, wanted, ...[msg, extra]) {
this.#t.currentAssert = this.#t.t.matchStrict;
const args = [msg, extra];
const me = normalizeMessageExtra('should match pattern', args);
const { match: ok, diff } = matchStrict(found, wanted, this.#opts);
if (ok)
return this.#t.pass(...me);
Object.assign(me[1], { diff });
return this.#t.fail(...me);
}
/**
* Verify that the value does not match the pattern provided, without
* type coercion.
*/
notMatchStrict(found, doNotWant, ...[msg, extra]) {
this.#t.currentAssert = this.#t.t.notMatchStrict;
const args = [msg, extra];
const me = normalizeMessageExtra('should not match pattern', args);
const { match: ok } = matchStrict(found, doNotWant, this.#opts);
if (!ok)
return this.#t.pass(...me);
Object.assign(me[1], { found, doNotWant });
return this.#t.fail(...me);
}
/**
* Verify that the object has the wanted property, anywhere in its

@@ -336,0 +399,0 @@ * prototype chain.

9

package.json
{
"name": "@tapjs/asserts",
"version": "0.0.0-9",
"version": "0.0.0-10",
"description": "",
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",
"type": "module",
"exports": {

@@ -41,7 +40,7 @@ "./package.json": {

"peerDependencies": {
"@tapjs/core": "0.0.0-9"
"@tapjs/core": "0.0.0-10"
},
"dependencies": {
"is-actual-promise": "^1.0.0",
"tcompare": "6.0.1-1",
"tcompare": "6.0.1-2",
"trivial-deferred": "^2.0.0"

@@ -48,0 +47,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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