CodeSampleX

Sample

@jest/expect-utils 29.7.0: equals

Verified sample for npm @jest/expect-utils 29.7.0: equals. The contract ran on node 22 · linux alpine/x64 · docker and passed.

sha256:47710044294bb121c7f79bb22c3e052f8fbb6a44f676422e88d7371c9b3d4472

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-23

Case

HOW
Goal
verify pkg:npm/%40jest/expect-utils@29.7.0
Packages
Symbols
  • equals
Environment
node 22.23.2
Created
2026-08-23T16:19:38Z

Contract

  1. equals performs structural deep equality check on primitives, nested objects, arrays, Dates, RegExps, Sets, and Maps
  2. equals resolves circular references without infinite recursion
  3. equals supports custom tester functions for specialized type comparisons
  4. equals with strictCheck false allows matching missing properties with undefined properties
  5. equals with strictCheck true rejects object property mismatches where one property is undefined and missing on the other
  6. equals with strictCheck true rejects sparse array vs dense undefined array differences

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.cjs

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pkg:npm/%40jest/expect-utils@29.7.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40jest/expect-utils@29.7.0
Demonstrate these symbols/APIs:
  - equals
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:601495bf77d38aaa47b43efede97e80148d930a857be5b02e45db77ffa4d0b95","constraints":{"executionContext":"node"},"contract":["equals performs structural deep equality check on primitives, nested objects, arrays, Dates, RegExps, Sets, and Maps","equals resolves circular references without infinite recursion","equals supports custom tester functions for specialized type comparisons","equals with strictCheck false allows matching missing properties with undefined properties","equals with strictCheck true rejects object property mismatches where one property is undefined and missing on the other","equals with strictCheck true rejects sparse array vs dense undefined array differences"],"goal":"verify pkg:npm/%40jest/expect-utils@29.7.0","kind":"HOW","packages":["pkg:npm/%40jest/expect-utils@29.7.0"],"schemaVersion":1,"symbols":["equals"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40jest/expect-utils@29.7.0"],"schemaVersion":1,"subject":"pkg:npm/%40jest/expect-utils@29.7.0","symbols":["equals"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-jest-expect-utils-equals",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-jest-expect-utils-equals",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@jest/expect-utils": "29.7.0"
      }
    },
    "node_modules/@jest/expect-utils": {
      "version": "29.7.0",
      "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz",
      "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==",
      "license": "MIT",
      "dependencies": {
        "jest-get-type": "^29.6.3"
      },
      "engines": {
        "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
      }
    },
    "node_modules/jest-get-type": {
      "version": "29.6.3",
      "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz",
      "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==",
      "license": "MIT",
      "engines": {
        "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
      }
    }
  }
}
package.json
{
  "name": "sample-jest-expect-utils-equals",
  "version": "1.0.0",
  "private": true,
  "description": "verify pkg:npm/%40jest/expect-utils@29.7.0",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@jest/expect-utils": "29.7.0"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40jest/expect-utils@29.7.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40jest/expect-utils@29.7.0"
  ],
  "symbols": [
    "equals"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const { equals } = require('@jest/expect-utils');

/**
 * Performs deep structural equality comparison between two values.
 *
 * @param {unknown} a - First value to compare.
 * @param {unknown} b - Second value to compare.
 * @param {Array<Function>} [customTesters] - Optional custom tester functions.
 * @param {boolean} [strictCheck=false] - Whether to perform strict checks.
 * @returns {boolean} True if values are deeply equal, false otherwise.
 */
function areDeeplyEqual(a, b, customTesters, strictCheck = false) {
  return equals(a, b, customTesters, strictCheck);
}

module.exports = {
  equals,
  areDeeplyEqual
};
test/contract.cjs
const assert = require('node:assert');
const { equals, areDeeplyEqual } = require('../src/index.js');

async function main() {
  // 1. equals performs structural deep equality check on primitives, nested objects, arrays, Dates, RegExps, Sets, and Maps
  assert.strictEqual(areDeeplyEqual(42, 42), true, 'primitives must match');
  assert.strictEqual(areDeeplyEqual('foo', 'foo'), true, 'strings must match');
  assert.strictEqual(areDeeplyEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }), true, 'nested objects and arrays must match');
  assert.strictEqual(areDeeplyEqual({ a: 1 }, { a: 2 }), false, 'different property values must not match');

  assert.strictEqual(areDeeplyEqual(new Date('2026-01-01'), new Date('2026-01-01')), true, 'identical dates must match');
  assert.strictEqual(areDeeplyEqual(new Date('2026-01-01'), new Date('2026-01-02')), false, 'different dates must not match');
  assert.strictEqual(areDeeplyEqual(/abc/g, /abc/g), true, 'identical regexes must match');
  assert.strictEqual(areDeeplyEqual(/abc/g, /abc/i), false, 'different regex flags must not match');

  const setA = new Set([1, 2, { x: 3 }]);
  const setB = new Set([1, 2, { x: 3 }]);
  assert.strictEqual(areDeeplyEqual(setA, setB), true, 'sets with deeply equal elements must match');

  const mapA = new Map([['k1', { v: 1 }]]);
  const mapB = new Map([['k1', { v: 1 }]]);
  assert.strictEqual(areDeeplyEqual(mapA, mapB), true, 'maps with deeply equal entries must match');

  // 2. equals resolves circular references without infinite recursion
  const circA = { name: 'circular' };
  circA.self = circA;
  const circB = { name: 'circular' };
  circB.self = circB;
  assert.strictEqual(areDeeplyEqual(circA, circB), true, 'circular structures must be handled without overflow');

  // 3. equals supports custom tester functions for specialized type comparisons
  const customTester = function(a, b) {
    if (typeof a === 'string' && typeof b === 'number') {
      return a === String(b);
    }
    return undefined;
  };
  assert.strictEqual(areDeeplyEqual('123', 123, [customTester]), true, 'custom tester should match string with number');
  assert.strictEqual(areDeeplyEqual('123', 456, [customTester]), false, 'custom tester should reject unequal numbers');

  // 4. equals with strictCheck false allows matching missing properties with undefined properties
  const objUndefined = { a: undefined };
  const objMissing = {};
  assert.strictEqual(areDeeplyEqual(objUndefined, objMissing, undefined, false), true, 'loose check matches undefined with missing prop');

  // 5. equals with strictCheck true rejects object property mismatches where one property is undefined and missing on the other
  assert.strictEqual(areDeeplyEqual(objUndefined, objMissing, undefined, true), false, 'strict check rejects undefined vs missing prop');

  // 6. equals with strictCheck true rejects sparse array vs dense undefined array differences
  assert.strictEqual(areDeeplyEqual([,], [undefined], undefined, false), true, 'loose check matches sparse hole with undefined');
  assert.strictEqual(areDeeplyEqual([,], [undefined], undefined, true), false, 'strict check distinguishes sparse hole from undefined');

  console.log('Contract assertions passed.');
  process.exit(0);
}

main().catch((err) => {
  console.error('Contract failed:', err);
  process.exit(1);
});

Origin Seeder

anonymous