brew install nvm (OSx with Brew installed)
nvm install 16.13.0
(Optional OSx only) Instruct NVM to use the project's required version of Node as set in the .nvmrc
file (16.13.0)
nvm use
npm install
Build time environment variables not stored in repo for safety reasons, these may not be the final solution for add variables, just this is how it's usually done!
3 files need adding to root directory alongside package.json
for example.
- .env.development.local
- .env.mocked.local
- .env.production.local
Sample content below
VITE_APP_TITLE=Fill In The Blanks Card Game
VITE_APP_DEV_TOOLS_ENABLED=true
VITE_APP_I18N_LOCALE=en-GB
VITE_APP_I18N_FALLBACK_LOCALE=en-GB
VITE_APP_VALIDATOR_COUNTRY=en-GB
VITE_APP_BASE_URL=http://127.0.0.1:8080/
VITE_APP_ROOT_PATH=/
VITE_APP_HOST=http://127.0.0.1
VITE_APP_PORT=:8080
npm run dev
Unit tests should be located within each component in a folder tests/unit
.
Snapshots compare current test with previous tests, these are automatically created on first run and added to folder tests/unit/__snapshots__
.
NOTE:
- Snapshots can be updated when required (see below).
- Unit test snapshots compare code result, not UI, this is handled via Playwright tests
- Run all unit tests (test against previous snapshots):
npm run test:unit
- Run all unit tests (update previous snapshots):
npm run test:unit -- -u
- Watch a specific unit test (tdd):
npm run test:unit:watch --NameOfTest.spec.js
npm run build
npm run deploy
npm run lint
OSx only - Tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input
git config --global core.autocrlf input
git config --global core.autocrlf true