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
12 changes: 7 additions & 5 deletions bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

# Check if the --no-open flag is provided
if [[ " $* " == *" --no-open "* ]]; then
NO_OPEN_FLAG="--no-open"
DOCUSAURUS_NO_OPEN="--no-open"
VITEST_NO_OPEN="--open=false"
else
NO_OPEN_FLAG=""
DOCUSAURUS_NO_OPEN=""
VITEST_NO_OPEN=""
fi

# Run the commands with concurrently
concurrently --names=format,pointers,web,jest \
concurrently --names=format,pointers,web,tests \
"cd ./packages/format && yarn watch" \
"cd ./packages/pointers && yarn watch" \
"cd ./packages/web && yarn start $NO_OPEN_FLAG" \
"yarn test --watchAll"
"cd ./packages/web && yarn start $DOCUSAURUS_NO_OPEN" \
"sleep 5 && yarn test --ui $VITEST_NO_OPEN"

15 changes: 4 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,16 @@
],
"scripts": {
"bundle": "tsx ./bin/bundle-schema.ts",
"test": "node --experimental-vm-modules ./node_modules/.bin/jest",
"test:debug": "open -a \"Brave Browser\" brave://inspect && node --experimental-vm-modules --nolazy --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --colors --verbose",
"test": "vitest",
"start": "./bin/start",
"lerna": "lerna",
"postinstall": "lerna run prepare"
},
"devDependencies": {
"@hyperjump/json-schema": "1.6.7",
"@types/jest": "^29.5.14",
"@vitest/ui": "^3.0.5",
"concurrently": "^8.2.2",
"jest": "^29.7.0",
"lerna": "^8.0.2",
"nodemon": "^3.0.2",
"ts-jest": "^29.2.5",
"tsx": "^4.16.2"
},
"dependencies": {
"@apideck/better-ajv-errors": "^0.3.6"
"tsx": "^4.16.2",
"vitest": "^3.0.5"
}
}
18 changes: 0 additions & 18 deletions packages/format/jest.config.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/format/jest.d.ts

This file was deleted.

8 changes: 3 additions & 5 deletions packages/format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prepare:yamls": "node ./bin/generate-schema-yamls.js > src/schemas/yamls.ts",
"prepare": "yarn prepare:yamls && tsc",
"clean": "rm -rf dist && rm src/schemas/yamls.ts",
"test": "node --experimental-vm-modules $(yarn bin jest)",
"test": "vitest",
"watch:typescript": "tsc --watch",
"watch:schemas": "nodemon --watch ../../schemas -e 'yaml' --exec 'yarn prepare:yamls'",
"watch": "concurrently --names=tsc,schemas \"yarn watch:typescript\" \"yarn watch:schemas\""
Expand All @@ -22,14 +22,12 @@
"yaml": "^2.3.4"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"chalk": "^4.1.0",
"concurrently": "^8.2.2",
"jest": "^29.7.0",
"nodemon": "^3.0.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^3.0.5"
},
"publishConfig": {
"access": "public"
Expand Down
43 changes: 15 additions & 28 deletions packages/format/src/types/data/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
import { expect, describe, it } from "@jest/globals";

import { describeSchema } from "../../describe";
import { testSchemaGuards } from "../../../test/guards";

import { Data } from "./index.js";

describe("type guards", () => {
const schemaGuards = [
{
schema: "schema:ethdebug/format/data/value",
guard: Data.isValue
},
{
schema: "schema:ethdebug/format/data/unsigned",
guard: Data.isUnsigned
},
{
schema: "schema:ethdebug/format/data/hex",
guard: Data.isHex
},
] as const;

it.each(schemaGuards)("matches its examples", ({
guard,
...describeSchemaOptions
}) => {
const { schema: { examples = [] } } = describeSchema(describeSchemaOptions);

expect(guard).toSatisfyAll(examples);
});
});
testSchemaGuards("ethdebug/format/data", [
{
schema: "schema:ethdebug/format/data/value",
guard: Data.isValue
},
{
schema: "schema:ethdebug/format/data/unsigned",
guard: Data.isUnsigned
},
{
schema: "schema:ethdebug/format/data/hex",
guard: Data.isHex
},
]);
66 changes: 23 additions & 43 deletions packages/format/src/types/materials/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
import { expect, describe, it } from "@jest/globals";

import { describeSchema } from "../../describe";

import { testSchemaGuards } from "../../../test/guards";
import { Materials } from "./index";

describe("type guards", () => {
const schemaGuards = [
{
schema: "schema:ethdebug/format/materials/id",
guard: Materials.isId
},
{
schema: "schema:ethdebug/format/materials/reference",
guard: Materials.isReference
},
{
schema: "schema:ethdebug/format/materials/compilation",
guard: Materials.isCompilation
},
{
schema: "schema:ethdebug/format/materials/source",
guard: Materials.isSource
},
{
schema: "schema:ethdebug/format/materials/source-range",
guard: Materials.isSourceRange
},
] as const;

for (const { guard, ...describeSchemaOptions } of schemaGuards) {
const { schema } = describeSchemaOptions;
describe(schema.slice("schema:".length), () => {
it("matches its examples", () => {
const {
schema: {
examples = []
}
} = describeSchema(describeSchemaOptions);

expect(guard).toSatisfyAll(examples);
});
});
}
});
testSchemaGuards("ethdebug/format/materials", [
{
schema: "schema:ethdebug/format/materials/id",
guard: Materials.isId
},
{
schema: "schema:ethdebug/format/materials/reference",
guard: Materials.isReference
},
{
schema: "schema:ethdebug/format/materials/compilation",
guard: Materials.isCompilation
},
{
schema: "schema:ethdebug/format/materials/source",
guard: Materials.isSource
},
{
schema: "schema:ethdebug/format/materials/source-range",
guard: Materials.isSourceRange
},
]);
Loading