From bd72da54e52470fff47d72d786d0f6b719478ed8 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Fri, 19 Jan 2024 09:58:10 +0100 Subject: [PATCH] Add contribution guide --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 344dafd93f8b..a9d1f70cbaba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,16 @@ Contributing to tests: - Do not pull unpinned versions from DockerHub (use deterministic tag) or Github (checkout commit not branch). - Carefully design tests that depend on timing sensitive events like p2p network e2e tests. Consider that Github runners are significantly less powerful than your development environment. +### Common Issues + +**Error: [vitest] Cannot mock "../../src/db/repositories/index.js" because it is already loaded by "src/db/beacon.ts"** + +If you observe any error in tests with matching to above error message, that implies you are loading the mocks in the wrong order. The correct order is to import the mocks first and then the actual module. We suggest to import the mocks on very top before any local modules. + +**✖ Error: Cannot find package 'async_hooks' imported from** + +If you observe following error running any of the test files that means you are running a file which itself or any dependency of that file imports `vitest`, but you are not running that file with `vitest` runner. Try running it with `yarn vitest` command, not with `node` command. + ### Debugging Spec Tests - To fix errors always focus on passing all minimal tests first without running mainnet tests.