This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ts-tests): refactor
ts-tests/*
to follow pnpm and turbo works…
…pace design (#86) #### What this PR does / why we need it: Move `ts-tests/*` to utilize pnpm and turbo mono-repo workspace design. With this, we managed to keep configs (eslint, prettier, babel jest) DRY. The PR "workspace-ize" `ts-tests` but ultimately many more PR is required to break this package into multiple smaller mono repo packages. Follow-up PRs required to address these: - [ ] ESLINT will be added back once we move to "testsuite", also part of #79 - [ ] #78 --- **What's new?** As suggested in #66 (comment) I've added hardhat compile turbo workflow. `@birthdayresearch/sticky-turbo-jest` is a turbo-aware `jest-preset`; it automatically run `dependsOn` script before running jest. By taking advantage of content-aware hashing from turborepo. `dependsOn` only runs if the pipeline `inputs` has changed. When you run your test with `@birthdayresearch/sticky-turbo-jest` preset, it uses `displayName` from your jest config to figure out which `pipeline` to use. It will automatically pinpoint the corresponding `dependsOn` and run all the scripts specified within. > TLDR, when you run a dependent test, it automatically recompiles your contract with hardhat when it detects changes in your `contracts/*.sol` file. If it has the cached version, it will simply "output" the result instead of rebuilding it. https://sticky.birthday.dev/packages/sticky-turbo-jest `package.json`: ```json "scripts": { "compile": "hardhat compile", "test": "jest" }, "jest": { "displayName": "test", "preset": "@birthdayresearch/sticky-turbo-jest" }, ``` `turbo.json`: ```json "compile": { "inputs": ["contracts/**"], "outputs": ["artifacts", "cache"] }, "test": { "inputs": ["src/**", "**/*.unit.ts", "tests-e2e/**"], "dependsOn": ["^build", "compile"] }, ``` #### Which issue(s) does this PR fixes?: <!-- (Optional) Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Fixes part of #79
- Loading branch information