diff --git a/.github/workflows/pull-request-develop.yml b/.github/workflows/pull-request-develop.yml index 77ea12c2c..3e0fe02d3 100644 --- a/.github/workflows/pull-request-develop.yml +++ b/.github/workflows/pull-request-develop.yml @@ -67,10 +67,30 @@ jobs: - name: "Check formatting" run: npx prettier ./packages --check + # type-checks all test folders (fast fail on compile errors) + test-check: + runs-on: ubuntu-latest + needs: install + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 22.9.0 + cache: npm + + - name: "Install dependencies" + run: npm ci --workspaces --include-workspace-root + + - name: "Build" + run: npm run build + + - name: "Type-check tests" + run: npm run test:check + # tests all packages test: runs-on: ubuntu-latest - needs: install + needs: test-check steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/nx.json b/nx.json index bd6ef8038..2a99cbc0c 100644 --- a/nx.json +++ b/nx.json @@ -8,6 +8,7 @@ "prisma:generate", "lint", "test", + "test:check", "integration" ] } diff --git a/package.json b/package.json index 41ced0d57..d423b74cf 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "lint:staged": "eslint", "format": "prettier --check \"packages/*/src/**/*.ts\" \"packages/*/test/**/*.ts\" \"packages/*/*.{cjs,json}\"", "format:write": "prettier --write \"packages/*/src/**/*.ts\" \"packages/*/test/**/*.ts\" \"packages/*/*.{cjs,json}\"", + "test:check": "npx lerna run test:check", "test": "npx lerna run test -- --passWithNoTests", "test:ci": "npx lerna run test --concurrency=1 -- --passWithNoTests --forceExit", "test:integration": "npx lerna run test:integration --concurrency=1 -- --passWithNoTests --forceExit", diff --git a/packages/api/package.json b/packages/api/package.json index 5ed16c570..862de0c71 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/common/package.json b/packages/common/package.json index 2a3b8d49d..4a10c9135 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/deployment/package.json b/packages/deployment/package.json index 360e6777e..17bd76f4c 100644 --- a/packages/deployment/package.json +++ b/packages/deployment/package.json @@ -11,6 +11,7 @@ "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", "test:watch": "npm run test:file -- ./test/** --watch", + "test:check": "tsc --noEmit -p test/tsconfig.json && tsc --noEmit -p test-integration/tsconfig.json", "test:integration": "npm run test:file -- ./test-integration/** --runInBand" }, "main": "dist/index.js", diff --git a/packages/indexer/package.json b/packages/indexer/package.json index 280fb3fdc..bf6d64283 100644 --- a/packages/indexer/package.json +++ b/packages/indexer/package.json @@ -11,6 +11,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./src/** ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./src/** ./test/** --watch", "prisma:generate": "prisma generate --schema=./prisma/schema.prisma", "prisma:migrate": "prisma migrate dev --schema=./prisma/schema.prisma" diff --git a/packages/library/package.json b/packages/library/package.json index c61439243..09b099a49 100644 --- a/packages/library/package.json +++ b/packages/library/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/module/package.json b/packages/module/package.json index d645791b6..f0027a940 100644 --- a/packages/module/package.json +++ b/packages/module/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/persistance/package.json b/packages/persistance/package.json index f32d864c9..b1ad7999d 100644 --- a/packages/persistance/package.json +++ b/packages/persistance/package.json @@ -12,6 +12,7 @@ "lint": "eslint ./src ./test ./test-integration", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json && tsc --noEmit -p test-integration/tsconfig.json", "test:integration": "npm run test:file -- ./test-integration/** --runInBand", "test:watch": "npm run test:file -- ./test/** --watch" }, diff --git a/packages/processor/package.json b/packages/processor/package.json index 3d81e2add..c84b05819 100644 --- a/packages/processor/package.json +++ b/packages/processor/package.json @@ -16,6 +16,7 @@ "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "prisma:generate": "prisma generate --schema=./test/prisma/schema.prisma", "test": "npm run test:file -- ./src/** ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./src/** ./test/** --watch" }, "publishConfig": { diff --git a/packages/protocol/package.json b/packages/protocol/package.json index fb63d3cce..65f53a8b8 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/protocol/test/compiling/types.ts b/packages/protocol/test/compiling/types.ts deleted file mode 100644 index fe1f231a0..000000000 --- a/packages/protocol/test/compiling/types.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Field, VerificationKey } from "o1js"; - -import { CompileRegistry, InferDependencyArtifacts } from "../../src"; -/* eslint-disable @typescript-eslint/no-unused-vars */ - -type TestModule = { - compile( - registry: CompileRegistry - ): Promise<{ bar: { verificationKey: VerificationKey } }>; -}; - -type Inferred = InferDependencyArtifacts<{ foo: TestModule }>; -const typeAssignmentTest: Inferred = { - foo: { - bar: { - verificationKey: { - data: "", - hash: Field(1), - }, - }, - }, -}; - -const typePropertyTest: Inferred["foo"]["bar"]["verificationKey"] extends VerificationKey - ? true - : false = true; - -/* eslint-enable @typescript-eslint/no-unused-vars */ diff --git a/packages/protocol/test/modularity/types.ts b/packages/protocol/test/modularity/types.ts index 233214b11..be3cd9460 100644 --- a/packages/protocol/test/modularity/types.ts +++ b/packages/protocol/test/modularity/types.ts @@ -4,7 +4,7 @@ import { TypedClass } from "@proto-kit/common"; import { GetContracts } from "../../src/settlement/modularity/types"; import { BridgeContractType, - MandatorySettlementModulesRecord, + BridgingSettlementModulesRecord, SettlementContractType, } from "../../src"; /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -12,7 +12,7 @@ import { // Goal of this "test" is that it compiles. By compiling this file checks that // certain types are inferred correctly -type Inferred = GetContracts; +type Inferred = GetContracts; // Get inferred Bridge Type type Bridge = Inferred["BridgeContract"]; diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 63f2d9419..b25922a81 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -10,6 +10,7 @@ "lint": "eslint ./src ./test", "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", + "test:check": "tsc --noEmit -p test/tsconfig.json", "test:watch": "npm run test:file -- ./test/** --watch" }, "main": "dist/index.js", diff --git a/packages/sequencer/package.json b/packages/sequencer/package.json index 2fe6b483e..d8705b23e 100644 --- a/packages/sequencer/package.json +++ b/packages/sequencer/package.json @@ -11,6 +11,7 @@ "test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", "test:watch": "npm run test:file -- ./test/** --watch", + "test:check": "tsc --noEmit -p test/tsconfig.json && tsc --noEmit -p test-integration/tsconfig.json && tsc --noEmit -p test-proven/tsconfig.json", "test:integration": "npm run test:file -- ./test-integration/** --runInBand", "start": "npm run build && node --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node ./dist/src/entry.js" }, diff --git a/packages/stack/package.json b/packages/stack/package.json index 742155463..f5a757ecf 100644 --- a/packages/stack/package.json +++ b/packages/stack/package.json @@ -11,6 +11,7 @@ "test:file": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js", "test": "npm run test:file -- ./test/**", "test:watch": "npm run test:file -- ./test/** --watch", + "test:check": "tsc --noEmit -p test/tsconfig.json && tsc --noEmit -p test-integration/tsconfig.json", "test:integration": "npm run test:file -- ./test-integration/** --runInBand", "graphql": "npm run build && node --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node ./dist/scripts/graphql/run-graphql.js", "start": "node --experimental-vm-modules --es-module-specifier-resolution=node ./dist/start.js"