Skip to content

Commit

Permalink
Type check test files (#248)
Browse files Browse the repository at this point in the history
* Rename all tsconfig.dest.json to tsconfig.json

* Rename all instances of tsconfig.dest.json to tsconfig.json

* Ignore tsbuildinfo

* Fix jest types

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64936/files

* Move anvil tests into src and skip for now

* Do not exclude test folders

* Rename package.scripts to package.common

* Remove explicit reference to tsconfig in project references

* Handle non-objects in update_package_jsons

* Add files and types entries to all packages

* Remove tsbuildinfo

* Fix jest config for aztec-rpc

* Fix jest config for aztec-node

* Add types patch to dockerfiles

* Drop tsconfig.json from build command since we're using the default
  • Loading branch information
spalladino authored Apr 12, 2023
1 parent 31d463a commit 463269c
Show file tree
Hide file tree
Showing 73 changed files with 672 additions and 583 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ All the packages that make up Aztec 3. Typescript projects exist in yarn-project
Package development:

- Run `yarn build:dev` in the root to interactively build the package.
- Run `yarn prepare` in the root to update tsconfig.dest.json and build_manifest.json files based on package.json contents.
- Run `yarn prepare` in the root to update tsconfig.json and build_manifest.json files based on package.json contents.
Note this only analyzes package.json imports to @aztec/\* packages.

Repo architecture:

- yarn-project/tsconfig.json: Base tsconfig file, extended by all packages. Used directly by vscode and eslint, where it functions to include the whole project without listing project references.
- yarn-project/tsconfig.dest.json: Used by `yarn build:dev` in root.
- package/tsconfig.dest.json: Each package has its own file that specifies its project reference dependencies. This allows them to be built independently.
- yarn-project/tsconfig.json: Used by `yarn build:dev` in root.
- package/tsconfig.json: Each package has its own file that specifies its project reference dependencies. This allows them to be built independently.
1 change: 1 addition & 0 deletions yarn-project/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
*.log
*.swp
.tsbuildinfo
tsconfig.tsbuildinfo

# Zero install: https://yarnpkg.com/features/zero-installs
.yarn/*
Expand Down
10 changes: 10 additions & 0 deletions yarn-project/@types/jest/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64936/files
declare namespace jest {
/**
* Replaces property on an object with another value.
*
* @remarks
* For mocking functions, and 'get' or 'set' accessors, use `jest.spyOn()` instead.
*/
function replaceProperty<T extends {}, K extends keyof T>(obj: T, key: K, value: T[K]): ReplaceProperty<T[K]>;
}
16 changes: 11 additions & 5 deletions yarn-project/acir-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "Acir Simulator",
"tsconfig": "./tsconfig.dest.json"
"tsconfig": "./tsconfig.json"
},
"scripts": {
"prepare": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json",
"prepare:check": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json --check",
"build": "yarn clean && tsc -b tsconfig.dest.json",
"build:dev": "tsc -b tsconfig.dest.json --watch",
"build": "yarn clean && tsc -b",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests"
},
"inherits": [
"../package.scripts.json"
"../package.common.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
Expand Down Expand Up @@ -56,5 +56,11 @@
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
},
"files": [
"dest",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts"
}
27 changes: 0 additions & 27 deletions yarn-project/acir-simulator/tsconfig.dest.json

This file was deleted.

26 changes: 26 additions & 0 deletions yarn-project/acir-simulator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "..",
"compilerOptions": {
"outDir": "dest",
"rootDir": "src",
"tsBuildInfoFile": ".tsbuildinfo"
},
"references": [
{
"path": "../barretenberg.js"
},
{
"path": "../circuits.js"
},
{
"path": "../foundation"
},
{
"path": "../merkle-tree"
},
{
"path": "../noir-contracts"
}
],
"include": ["src"]
}
18 changes: 12 additions & 6 deletions yarn-project/archiver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "Archiver",
"tsconfig": "./tsconfig.dest.json"
"tsconfig": "./tsconfig.json"
},
"scripts": {
"prepare": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json",
"prepare:check": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json --check",
"build": "yarn clean && tsc -b tsconfig.dest.json",
"build:dev": "tsc -b tsconfig.dest.json --watch",
"build": "yarn clean && tsc -b",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests",
"start": "node ./dest",
"start:dev": "tsc-watch -p tsconfig.dest.json --onSuccess 'yarn start'",
"start:dev": "tsc-watch -p tsconfig.json --onSuccess 'yarn start'",
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"",
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
},
"inherits": [
"../package.scripts.json"
"../package.common.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
Expand Down Expand Up @@ -57,5 +57,11 @@
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.3"
}
},
"files": [
"dest",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts"
}
24 changes: 0 additions & 24 deletions yarn-project/archiver/tsconfig.dest.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
},
"references": [
{
"path": "../ethereum.js/tsconfig.dest.json"
"path": "../ethereum.js"
},
{
"path": "../foundation/tsconfig.dest.json"
"path": "../foundation"
},
{
"path": "../l1-contracts"
},
{
"path": "../types"
}
],
"include": ["src"],
"exclude": ["**/*.test.*", "**/fixtures/*"]
"include": ["src"]
}
16 changes: 11 additions & 5 deletions yarn-project/aztec-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "Aztec cli",
"tsconfig": "./tsconfig.dest.json"
"tsconfig": "./tsconfig.json"
},
"bin": {
"aztec_cli": "index.js"
},
"scripts": {
"prepare": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json",
"prepare:check": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json --check",
"build": "yarn clean && tsc -b tsconfig.dest.json",
"build:dev": "tsc -b tsconfig.dest.json --watch",
"build": "yarn clean && tsc -b",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests"
},
"inherits": [
"../package.scripts.json"
"../package.common.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
Expand Down Expand Up @@ -52,5 +52,11 @@
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
},
"files": [
"dest",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
},
"references": [
{
"path": "../foundation/tsconfig.dest.json"
"path": "../foundation"
}
],
"exclude": ["**/*.test.*", "**/fixtures/*"],
"include": ["src"]
}
28 changes: 14 additions & 14 deletions yarn-project/aztec-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "Aztec Node",
"tsconfig": "./tsconfig.dest.json"
"tsconfig": "./tsconfig.json"
},
"scripts": {
"prepare": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json",
"prepare:check": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json --check",
"build": "yarn clean && tsc -b tsconfig.dest.json",
"build:dev": "tsc -b tsconfig.dest.json --watch",
"build": "yarn clean && tsc -b",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
Expand All @@ -22,16 +22,10 @@
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
},
"inherits": [
"../package.scripts.json"
"../package.common.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"globals": {
"ts-jest": {
"useESM": true,
"tsconfig": "../tsconfig.json"
}
},
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
Expand All @@ -54,12 +48,18 @@
"devDependencies": {
"@jest/globals": "^29.4.3",
"@rushstack/eslint-patch": "^1.1.4",
"@types/jest": "^29.4.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.7.23",
"concurrently": "^7.6.0",
"jest": "^28.1.3",
"ts-jest": "^28.0.7",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
},
"files": [
"dest",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ import { WalletProvider } from '@aztec/ethereum.js/provider';
import { EthAddress, createDebugLogger, sleep } from '@aztec/foundation';
import { INITIAL_L2_BLOCK_NUM } from '@aztec/l1-contracts';
import { Tx } from '@aztec/types';
import { AztecNode } from '../index.js';
import { AztecNodeConfig } from './config.js';
import { createProvider, createTx, deployRollupContract, deployUnverifiedDataEmitterContract } from './fixtures.js';
import { AztecNode, AztecNodeConfig } from '../index.js';
import {
createProvider,
createTx,
deployRollupContract,
deployUnverifiedDataEmitterContract,
} from '../aztec-node/fixtures.js';

const ETHEREUM_HOST = 'http://127.0.0.1:8545/';
const MNEMONIC = 'test test test test test test test test test test test junk';

const logger = createDebugLogger('aztec:e2e_test');

describe('AztecNode', () => {
describe.skip('AztecNode', () => {
let rollupAddress: EthAddress;
let unverifiedDataEmitterAddress: EthAddress;
let node: AztecNode;
Expand Down
42 changes: 0 additions & 42 deletions yarn-project/aztec-node/tsconfig.dest.json

This file was deleted.

Loading

0 comments on commit 463269c

Please sign in to comment.