Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
"yaml": "^2.3.4"
},
"devDependencies": {
"@hyperjump/browser": "^1.2.0",
"@hyperjump/json-schema": "^1.11.0",
"chalk": "^4.1.0",
"cli-highlight": "^2.1.11",
"concurrently": "^8.2.2",
"indent-string": "^4.0.0",
"nodemon": "^3.0.2",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { expect, describe, it } from "vitest";

import type { JSONSchema } from "@ethdebug/format";

import schemas, { schemaExtensions } from "../src/schemas.js";
import { schemaExtensions } from "../../test/extensions";
import { schemas } from ".";
import type { JSONSchema } from "../describe";

// loads schemas into global hyperjump json schema validator
import "../src/loadSchemas.js";
import "../../test/hyperjump";

const idsOfSchemasAllowedToOmitExamples = new Set([
"schema:ethdebug/format/type",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import { describe, it } from "vitest";
import {
type OutputUnit,
validate,
InvalidSchemaError,
} from "@hyperjump/json-schema/draft-2020-12";

import schemas from "../src/schemas.js";
import printErrors from "../src/printErrors.js";
import { schemas } from ".";

// loads schemas into global hyperjump json schema validator
import "../src/loadSchemas.js";
import "../../test/hyperjump";

const printErrors = (output: OutputUnit): string => output.errors!
.map((error) => {
if (!error.valid && !error.keyword.endsWith("#validate")) {
return `${
error.instanceLocation
} fails schema constraint ${
error.absoluteKeywordLocation
}`;
}
})
.filter((message): message is string => !!message)
.map(message => ` - ${message}`)
.join("\n");

describe("Valid schemas", () => {
for (const [id, schema] of Object.entries(schemas)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schemas } from "@ethdebug/format";
import { schemas } from "../src";

export const schemaExtensions: {
[schemaId: string]: {
Expand Down Expand Up @@ -81,5 +81,3 @@ export const schemaExtensions: {
extends: new Set(["schema:ethdebug/format/type/complex"])
},
}

export default schemas;
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import {
validate,
setMetaSchemaOutputFormat,
} from "@hyperjump/json-schema/draft-2020-12";
// @ts-ignore
import { BASIC } from "@hyperjump/json-schema/experimental";
import { bundle } from "@hyperjump/json-schema/bundle";
import YAML from "yaml";
import * as YAML from "yaml";
import indentString from "indent-string";
import { highlight } from "cli-highlight";

import {
describeSchema,
type DescribeSchemaOptions
} from "@ethdebug/format";
} from "../src/describe";

import schemas from "./schemas.js";
import { schemas } from "../src/schemas";

const main = () => {
setMetaSchemaOutputFormat(BASIC);
Expand Down
3 changes: 3 additions & 0 deletions packages/format/vitest.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import "vitest";
import type { DescribeSchemaOptions } from "./src/describe";

interface CustomMatchers<R = unknown> {
toValidate(schemaOptions: DescribeSchemaOptions): R;

toSatisfy(received: any): R;
toSatisfyAll(values: readonly any[]): R;
}
Expand Down
1 change: 0 additions & 1 deletion packages/tests/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions packages/tests/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions packages/tests/src/printErrors.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/tests/tsconfig.json

This file was deleted.

13 changes: 0 additions & 13 deletions packages/tests/typings.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/tests/vitest.config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8151,11 +8151,6 @@ indent-string@^4.0.0:
resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz"
integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==

indent-string@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz"
integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==

infima@0.2.0-alpha.43:
version "0.2.0-alpha.43"
resolved "https://registry.npmjs.org/infima/-/infima-0.2.0-alpha.43.tgz"
Expand Down