-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type check test files #248
Conversation
88c54b9
to
fe95fff
Compare
yarn-project/archiver/package.json
Outdated
}, | ||
"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 tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do this in a followup PR but because tsconfig.json is the default name, we can actually drop all these -b and p flags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or I can change it really quick with a yarn prepare!
"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'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: -p tsconfig.json can also be simplified
@@ -6,20 +6,20 @@ | |||
"typedoc": { | |||
"entryPoint": "./src/index.ts", | |||
"displayName": "Aztec.js", | |||
"tsconfig": "./tsconfig.dest.json" | |||
"tsconfig": "./tsconfig.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually if we care, also can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Also I rather power read 72 files over 14 commits any day ^_^
* adding adrians new transcript classes * tests added for transcript and new manifest concept --------- Co-authored-by: codygunton <[email protected]>
* adding adrians new transcript classes * tests added for transcript and new manifest concept --------- Co-authored-by: codygunton <[email protected]>
This PR includes test files in tsconfig, so they are type checked. Now, any type error in a test file is surfaced when building (eg when running build:dev at the project root). This makes refactors that impact test files much easier to handle, since type errors are caught by the compiler and don't need running the tests.
To avoid bundling the tests with the published packages, every package.json now has a
files
field that defines what gets included, and explicitly removes tests. We are including:Note that the first is the only one actually required for consuming the package. The second is highly recommended to be included, so ts consumers benefit from type definitions. The last two are pretty much optional, and assist clients with debugging, but we could drop them if we think package size becomes an issue.
Adding tests to build surfaced an error with our jest types. Apparently we hit an error with jest type definitions, which is being fixed here. I added a temporary (let's see for how long it survives in the repo!) patch to the type definition to fix it.
This PR changes a lot of files, but each commit should be pretty self-contained, so I suggest reviewing by each individual commit.
Fixes #219