Open thomasgwatson opened 1 month ago
Getting tests working on the backend...
ok, so steps so far.
Now running "test": "mocha -r test/setup/core -r @babel/register --exit", as the test command. The test/setup/core file was setting the NODE_ENV to test anyway, so seems redundant to have some reference to NODE_ENV in the command itself.
Maybe its there for a reason but can't see any comments to suggest why
The next problem was .load() was failing on dotenv references... updated the dotenv dependences and .load() is gone now, instead you use .config().
Now the warning that the test database needs to have test in its name; which is great because you don't want running tests to nuke your databases :slightly_smiling_face:
Previously we had a .env.test file that defined the test db to point at (amongst other things)
That hadn't been pulled across from my prior node repo, so I pulled that across.
But its still throwing the same error. So the setup isn't picking up the test env file. I assume it did previously, so now I just need to figure out how to get it to grab .env.test instead of .env when its testing
Thanks Tom! I'll be back home starting this coming week, and will pick up where you are, hopefully. It may be good to schedule a call with you so we can work together. Will let you know if I need that. Ta!
This may be of some help. It is the start and some decent progress on getting CircleCI to "do the right thing" with the monorepo, i.e. it will run tests on a branch for any of the effected projects (web, mobile, or backend). So if there are only changes in the branch for mobile, only mobile tests run.
I THINK I'd gotten the backend tests were running in this setup, but need to confirm. However this worked out, it was at least successful running in Yarn Berry.
As of 15 OCT 2024:
We are ready to switch to monorepo usage now with the following caveats and instructions:
apps/web
andapps/mobile
do link dynamically (with hot reloading in dev) topackages/shared (@hylo/shared)
apps/api
is still linked to the legacy npm packagehylo-shared
so unless we need to still don’t add anything tolibs/shared
until I get it also linked up #todoapps/api
andapps/web
are currently set to not hoist their dependencies up, which is in efficient but shouldn’t impact the dev workflow at this point #todoUsing it:
main
branch which reflects the following states for each legacy repo:apps/web
is at branchmonorepo-setup-shared
with some additional monorepo related configapps/api
is at branchdev
apps/mobile
is at branchdev
(which does include collective moderation / 5.9 release)packages/shared
is the latest frommain
(so same as hylo-shared 5.2.5 on npm currently)yarn install
from anywhere in the monorepo from anywhere in the repo to install for everything..env
files from your local checkouts of the legacy repos to their respective roots in the monorepo (e.g. hylo-evo/,env goes to apps/web/.env, etc)scripts/configure.sh
and do abundle install
andpod install
,
yarn dev’, etc).There are a few workspace level scripts shortcut scripts there for convienance:
yarn web:dev
=yarn workspace web dev
yarn api:dev
=yarn workspace api dev
yarn mobile:dev
=yarn workspace api start
yarn mobile:pod-install
= does the pod install thing from the apps/mobile/ios diryarn mobile:ios
does the ios build and attempts to run the simyarn mobile:android
does the android build and attempts to run the simAdding code going forward
dev