Socket
Socket
Sign inDemoInstall

@arktype/attest

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arktype/attest - npm Package Compare versions

Comparing version 0.7.3 to 0.7.5

6

out/assert/chainableAssertions.d.ts

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

import { snapshot, type Constructor, type Guardable } from "@arktype/util";
import { snapshot, type Constructor } from "@arktype/util";
import type { Completions } from "../cache/writeAssertionCache.js";

@@ -13,6 +13,5 @@ import type { AssertionContext } from "./attest.js";

private serialize;
private get actual();
private get unversionedActual();
private get serializedActual();
private snapRequiresUpdate;
narrow(predicate: Guardable, messageOnError?: string): never;
get unknown(): this;

@@ -54,3 +53,2 @@ is(expected: unknown): this;

completions: (value?: Completions) => void;
narrow<narrowed>(predicate: (data: unknown) => data is narrowed, messageOnError?: string): narrowed;
unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">;

@@ -57,0 +55,0 @@ };

@@ -16,3 +16,3 @@ import { caller } from "@arktype/fs";

}
get actual() {
get unversionedActual() {
if (this.ctx.actual instanceof TypeAssertionMapping) {

@@ -24,3 +24,3 @@ return this.ctx.actual.fn(this.ctx.typeRelationshipAssertionEntries[0][1], this.ctx).actual;

get serializedActual() {
return this.serialize(this.actual);
return this.serialize(this.unversionedActual);
}

@@ -31,14 +31,4 @@ snapRequiresUpdate(expectedSerialized) {

// to the snap even though it will serialize to the same value as the (nonexistent) first arg
this.actual === undefined);
this.unversionedActual === undefined);
}
narrow(predicate, messageOnError) {
if (!predicate(this.actual)) {
throwAssertionError({
ctx: this.ctx,
message: messageOnError ??
`${this.serializedActual} failed to satisfy predicate${predicate.name ? ` ${predicate.name}` : ""}`
});
}
return this.actual;
}
get unknown() {

@@ -48,15 +38,15 @@ return this;

is(expected) {
assert.equal(this.actual, expected);
assert.equal(this.unversionedActual, expected);
return this;
}
equals(expected) {
assertEquals(expected, this.actual, this.ctx);
assertEquals(expected, this.ctx.actual, this.ctx);
return this;
}
instanceOf(expected) {
if (!(this.actual instanceof expected)) {
if (!(this.ctx.actual instanceof expected)) {
throwAssertionError({
ctx: this.ctx,
message: `Expected an instance of ${expected.name} (was ${typeof this.actual === "object" && this.actual !== null ?
this.actual.constructor.name
message: `Expected an instance of ${expected.name} (was ${typeof this.ctx.actual === "object" && this.ctx.actual !== null ?
this.ctx.actual.constructor.name
: this.serializedActual})`

@@ -87,3 +77,3 @@ });

// but serialize to the same value.
if (printable(args[0]) !== printable(this.actual))
if (printable(args[0]) !== printable(this.unversionedActual))
assertEquals(expectedSerialized, this.serializedActual, this.ctx);

@@ -124,5 +114,5 @@ }

if (this.ctx.allowRegex)
assertEqualOrMatching(expected, this.actual, this.ctx);
assertEqualOrMatching(expected, this.ctx.actual, this.ctx);
else
assertEquals(expected, this.actual, this.ctx);
assertEquals(expected, this.ctx.actual, this.ctx);
return this;

@@ -135,3 +125,3 @@ };

get throws() {
const result = callAssertedFunction(this.actual);
const result = callAssertedFunction(this.unversionedActual);
this.ctx.actual = getThrownMessage(result, this.ctx);

@@ -143,3 +133,3 @@ this.ctx.allowRegex = true;

throwsAndHasTypeError(matchValue) {
assertEqualOrMatching(matchValue, getThrownMessage(callAssertedFunction(this.actual), this.ctx), this.ctx);
assertEqualOrMatching(matchValue, getThrownMessage(callAssertedFunction(this.unversionedActual), this.ctx), this.ctx);
if (!this.ctx.cfg.skipTypes) {

@@ -146,0 +136,0 @@ assertEqualOrMatching(matchValue, new TypeAssertionMapping(data => ({

@@ -19,3 +19,3 @@ import { shell, writeJson } from "@arktype/fs";

else {
forTypeScriptVersions(config.tsVersions, version => shell(`npm exec -c "attestPrecache ${join(config.assertionCacheDir, version.alias + ".json")}"`));
forTypeScriptVersions(config.tsVersions, version => shell(`npm exec -c "attest precache ${join(config.assertionCacheDir, version.alias + ".json")}"`));
}

@@ -22,0 +22,0 @@ };

{
"name": "@arktype/attest",
"version": "0.7.3",
"version": "0.7.5",
"author": {

@@ -33,5 +33,5 @@ "name": "David Blass",

"dependencies": {
"arktype": "2.0.0-dev.10",
"@arktype/fs": "0.0.18",
"@arktype/util": "0.0.37",
"arktype": "2.0.0-dev.11",
"@arktype/fs": "0.0.19",
"@arktype/util": "0.0.41",
"@typescript/vfs": "1.5.0",

@@ -38,0 +38,0 @@ "@typescript/analyze-trace": "0.10.1"

@@ -158,2 +158,8 @@ # Attest

If you'd like to fail in CI above a threshold, you can add flags like the following (default value is 20%, but it will not throw unless `--benchErrorOnThresholdExceeded` is set):
```
tsx ./p99/within-limit/p99-tall-simple.bench.ts --benchErrorOnThresholdExceeded --benchPercentThreshold 10
```
## CLI

@@ -160,0 +166,0 @@

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