CodeSampleX

Пример

jest-validate 30.4.1: multipleValidOptions

Проверенный пример — npm jest-validate 30.4.1: multipleValidOptions. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден.

sha256:b57aac42ae864bf73bf7d409a3703852d812dc3e1a01d26622d20e84b6dcf81c

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. MIT-0

Свидетельства выполнения

Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.

Основа свидетельства
Подписанный контракт пройден
Квитанции проверки
1
Ключи подписи, собравшие его
1
Заявленная среда node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Среды запусков проверки

Окружение Контракт Этапы Запуск
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-06

Кейс

HOW
Цель
verify jest-validate.multipleValidOptions in pkg:npm/jest-validate@30.4.1
Пакеты
Символы
  • jest-validate.multipleValidOptions
Окружение
node 22.23.2
Создан
2026-09-06T01:11:27Z

Контракт

  1. multipleValidOptions returns an option descriptor supporting multiple alternative valid types
  2. validateWithMultipleOptions passes when option matches primary type in multipleValidOptions schema
  3. validateWithMultipleOptions passes when option matches secondary type in multipleValidOptions schema
  4. validateWithMultipleOptions throws ValidationError when option type matches none of multipleValidOptions
  5. validateWithMultipleOptions throws ValidationError when mixed-type option receives unsupported type

Файлы

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

Скачать артефакт с исходным кодом (tar.gz)

Исходный код

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 jest-validate.multipleValidOptions in pkg:npm/jest-validate@30.4.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/jest-validate@30.4.1
Demonstrate these symbols/APIs:
  - jest-validate.multipleValidOptions

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:94c4b329ac7480fd348347d015a0325dd5382a25a4943c473f09fda004babf12","constraints":{"executionContext":"node"},"contract":["multipleValidOptions returns an option descriptor supporting multiple alternative valid types","validateWithMultipleOptions passes when option matches primary type in multipleValidOptions schema","validateWithMultipleOptions passes when option matches secondary type in multipleValidOptions schema","validateWithMultipleOptions throws ValidationError when option type matches none of multipleValidOptions","validateWithMultipleOptions throws ValidationError when mixed-type option receives unsupported type"],"goal":"verify jest-validate.multipleValidOptions in pkg:npm/jest-validate@30.4.1","kind":"HOW","packages":["pkg:npm/jest-validate@30.4.1"],"schemaVersion":1,"symbols":["jest-validate.multipleValidOptions"]},"contractCommand":["node","test/contract.mjs"],"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/jest-validate@30.4.1"],"schemaVersion":1,"subject":"pkg:npm/jest-validate@30.4.1","symbols":["jest-validate.multipleValidOptions"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-jest-validate-multiple-valid-options",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-jest-validate-multiple-valid-options",
      "version": "1.0.0",
      "dependencies": {
        "jest-validate": "30.4.1"
      }
    },
    "node_modules/@jest/get-type": {
      "version": "30.1.0",
      "resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz",
      "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==",
      "license": "MIT",
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/@jest/pattern": {
      "version": "30.4.0",
      "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.4.0.tgz",
      "integrity": "sha512-RAWn3+f9u8BsHijKJ71uHcFp6vmyEt6VvoWXkl6hKF3qVIuWNmudVjg12DlBPGup/frIl5UcUlH5HfEuvHpEXg==",
      "license": "MIT",
      "dependencies": {
        "@types/node": "*",
        "jest-regex-util": "30.4.0"
      },
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/@jest/schemas": {
      "version": "30.4.1",
      "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.4.1.tgz",
      "integrity": "sha512-i6b4qw5qnP8c5FEeBJg/uZQ4ddrkN6Ca8qISJh0pr7a5hfn3h3v5x60BEbOC7OYAGZNMs1LfFLwnW2CuK8F57Q==",
      "license": "MIT",
      "dependencies": {
        "@sinclair/typebox": "^0.34.0"
      },
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/@jest/types": {
      "version": "30.4.1",
      "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.4.1.tgz",
      "integrity": "sha512-f1x/vJXIfjOlEmejYpbkbgw1gOqpPECwMvMEtBqe47j7H2Hg8h8w3o3ikhSXq3MI15kg+oQ0exWO0uCtTNJLoQ==",
      "license": "MIT",
      "dependencies": {
        "@jest/pattern": "30.4.0",
        "@jest/schemas": "30.4.1",
        "@types/istanbul-lib-coverage": "^2.0.6",
        "@types/istanbul-reports": "^3.0.4",
        "@types/node": "*",
        "@types/yargs": "^17.0.33",
        "chalk": "^4.1.2"
      },
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/@sinclair/typebox": {
      "version": "0.34.52",
      "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.52.tgz",
      "integrity": "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==",
      "license": "MIT"
    },
    "node_modules/@types/istanbul-lib-coverage": {
      "version": "2.0.6",
      "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
      "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",
      "license": "MIT"
    },
    "node_modules/@types/istanbul-lib-report": {
      "version": "3.0.3",
      "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz",
      "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",
      "license": "MIT",
      "dependencies": {
        "@types/istanbul-lib-coverage": "*"
      }
    },
    "node_modules/@types/istanbul-reports": {
      "version": "3.0.4",
      "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz",
      "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",
      "license": "MIT",
      "dependencies": {
        "@types/istanbul-lib-report": "*"
      }
    },
    "node_modules/@types/node": {
      "version": "26.4.1",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.1.tgz",
      "integrity": "sha512-k97ENvZWtvA6yqz5/FS6a7duDgOPEeOQOc2iKS/nY6mX6qJUKtLnWzQS+Xj6tXweyj6ZcTAK2Qecetnvi9nCLA==",
      "license": "MIT",
      "dependencies": {
        "undici-types": "~8.3.0"
      }
    },
    "node_modules/@types/yargs": {
      "version": "17.0.35",
      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz",
      "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==",
      "license": "MIT",
      "dependencies": {
        "@types/yargs-parser": "*"
      }
    },
    "node_modules/@types/yargs-parser": {
      "version": "21.0.3",
      "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
      "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
      "license": "MIT"
    },
    "node_modules/ansi-styles": {
      "version": "4.3.0",
      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
      "license": "MIT",
      "dependencies": {
        "color-convert": "^2.0.1"
      },
      "engines": {
        "node": ">=8"
      },
      "funding": {
        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
      }
    },
    "node_modules/camelcase": {
      "version": "6.3.0",
      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
      "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
      "license": "MIT",
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/chalk": {
      "version": "4.1.2",
      "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
      "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
      "license": "MIT",
      "dependencies": {
        "ansi-styles": "^4.1.0",
        "supports-color": "^7.1.0"
      },
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/chalk/chalk?sponsor=1"
      }
    },
    "node_modules/color-convert": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
      "license": "MIT",
      "dependencies": {
        "color-name": "~1.1.4"
      },
      "engines": {
        "node": ">=7.0.0"
      }
    },
    "node_modules/color-name": {
      "version": "1.1.4",
      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
      "license": "MIT"
    },
    "node_modules/has-flag": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
      "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/jest-regex-util": {
      "version": "30.4.0",
      "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.4.0.tgz",
      "integrity": "sha512-mWlvLviKIgIQ8VCuM1xRdD0TWp3zlzionlmDBjuXVBs+VkmXq6FgW9T4Emr7oGz/Rk6feDCGyiugolcQEyp3mg==",
      "license": "MIT",
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/jest-validate": {
      "version": "30.4.1",
      "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-30.4.1.tgz",
      "integrity": "sha512-PDWi4SOwLnwqNDfHZjOcsEFyZ4fc/2W2gVL3DEoyqnB6jCQMLRtfBong8s6omIw3lI0HWOus12xfnFmQtjW3fw==",
      "license": "MIT",
      "dependencies": {
        "@jest/get-type": "30.1.0",
        "@jest/types": "30.4.1",
        "camelcase": "^6.3.0",
        "chalk": "^4.1.2",
        "leven": "^3.1.0",
        "pretty-format": "30.4.1"
      },
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/leven": {
      "version": "3.1.0",
      "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
      "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/pretty-format": {
      "version": "30.4.1",
      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.4.1.tgz",
      "integrity": "sha512-K6KiKMHTL4jjX4u3Kir2EW07nRfcqVTXIImx50wbjHQTcZPgg+gjVeNTIT3l3L1Rd4UefxfogquC9J37SoFyyw==",
      "license": "MIT",
      "dependencies": {
        "@jest/schemas": "30.4.1",
        "ansi-styles": "^5.2.0",
        "react-is-18": "npm:react-is@^18.3.1",
        "react-is-19": "npm:react-is@^19.2.5"
      },
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    },
    "node_modules/pretty-format/node_modules/ansi-styles": {
      "version": "5.2.0",
      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
      "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
      "license": "MIT",
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
      }
    },
    "node_modules/react-is-18": {
      "name": "react-is",
      "version": "18.3.1",
      "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
      "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
      "license": "MIT"
    },
    "node_modules/react-is-19": {
      "name": "react-is",
      "version": "19.2.8",
      "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz",
      "integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==",
      "license": "MIT"
    },
    "node_modules/supports-color": {
      "version": "7.2.0",
      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
      "license": "MIT",
      "dependencies": {
        "has-flag": "^4.0.0"
      },
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/undici-types": {
      "version": "8.3.0",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
      "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-jest-validate-multiple-valid-options",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of jest-validate.multipleValidOptions",
  "main": "src/index.js",
  "dependencies": {
    "jest-validate": "30.4.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify jest-validate.multipleValidOptions in pkg:npm/jest-validate@30.4.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/jest-validate@30.4.1"
  ],
  "symbols": [
    "jest-validate.multipleValidOptions"
  ]
}
src/index.js
const { validate, multipleValidOptions, ValidationError } = require('jest-validate');

/**
 * Creates an example configuration schema definition that supports multiple valid types for specific options.
 * @param {Record<string, unknown>} schema - Schema mapping option names to default examples or multipleValidOptions.
 * @returns {Record<string, unknown>}
 */
function defineOptionsSchema(schema) {
  return { ...schema };
}

/**
 * Validates a user configuration against an example schema supporting multiple valid option types.
 * @param {Record<string, unknown>} config - User configuration to validate.
 * @param {Record<string, unknown>} exampleConfig - Baseline example configuration containing multipleValidOptions.
 * @param {object} [options] - Additional validation options passed to jest-validate.
 * @returns {{ hasDeprecationWarnings: boolean, isValid: boolean }}
 */
function validateWithMultipleOptions(config, exampleConfig, options = {}) {
  return validate(config, {
    exampleConfig,
    ...options
  });
}

module.exports = {
  defineOptionsSchema,
  validateWithMultipleOptions,
  multipleValidOptions,
  validate,
  ValidationError
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  defineOptionsSchema,
  validateWithMultipleOptions,
  multipleValidOptions,
  validate,
  ValidationError
} = require('../src/index.js');

// 1. Export verification
assert.strictEqual(typeof multipleValidOptions, 'function', 'multipleValidOptions must be a function');
assert.strictEqual(typeof validateWithMultipleOptions, 'function', 'validateWithMultipleOptions must be a function');
assert.strictEqual(typeof defineOptionsSchema, 'function', 'defineOptionsSchema must be a function');
assert.strictEqual(typeof validate, 'function', 'validate must be a function');
assert.strictEqual(typeof ValidationError, 'function', 'ValidationError must be a function');

// 2. multipleValidOptions returns a valid option descriptor containing the supplied alternatives
const rawDescriptor = multipleValidOptions('https://example.com', ['https://replica1.example.com', 'https://replica2.example.com']);
assert(Array.isArray(rawDescriptor), 'multipleValidOptions should return an array-like structure');
assert.strictEqual(rawDescriptor.length, 2, 'multipleValidOptions should contain all specified variants');

// 3. Define schema with multiple valid options for endpoints and retry policies
const schema = defineOptionsSchema({
  endpoint: multipleValidOptions(
    'https://example.com',
    ['https://replica1.example.com', 'https://replica2.example.com']
  ),
  retries: multipleValidOptions(3, false),
  timeoutMs: 5000
});

// 4. Validate successfully with primary variant type (string endpoint, numeric retries)
const configVariantA = {
  endpoint: 'https://example.com',
  retries: 5,
  timeoutMs: 10000
};
const resultA = validateWithMultipleOptions(configVariantA, schema);
assert.deepStrictEqual(resultA, {
  hasDeprecationWarnings: false,
  isValid: true
}, 'Validation should pass for primary option types');

// 5. Validate successfully with secondary variant type (array of strings endpoint, boolean retries)
const configVariantB = {
  endpoint: ['https://replica1.example.com', 'https://replica2.example.com'],
  retries: false
};
const resultB = validateWithMultipleOptions(configVariantB, schema);
assert.deepStrictEqual(resultB, {
  hasDeprecationWarnings: false,
  isValid: true
}, 'Validation should pass for secondary option types');

// 6. Validation throws ValidationError when option matches none of the multipleValidOptions
const invalidConfig = {
  endpoint: 12345
};

assert.throws(
  () => {
    validateWithMultipleOptions(invalidConfig, schema);
  },
  (err) => {
    assert(err instanceof ValidationError, 'Thrown error must be an instance of ValidationError');
    assert(err.message.includes('Option "endpoint" must be of type:'), 'Error message should indicate expected type');
    return true;
  },
  'Should throw ValidationError for value matching none of multipleValidOptions'
);

// 7. Validation throws ValidationError when boolean/number option receives a string
assert.throws(
  () => {
    validateWithMultipleOptions({ retries: 'disabled' }, schema);
  },
  (err) => {
    assert(err instanceof ValidationError, 'Thrown error must be an instance of ValidationError');
    assert(err.message.includes('Option "retries" must be of type:'), 'Error message should indicate expected type');
    return true;
  },
  'Should throw ValidationError for invalid retries type'
);

console.log('Contract tests passed successfully.');

Исходный сидер

аноним