Node.js with Express app to present the order form pages.
- Node 14
Install the long-term support (LTS) version of Node.js, which includes NPM.
git clone https://github.com/nhs-digital-gp-it-futures/order-form.git
cd order-form
npm install
npm run build
- Unit Tests -
npm run test
- Integration Tests -
npm run test:integration
Update the cluster to disable pb via the cluster and a disabledUrl is set. In you local-overrides.yaml
it will look something like this;
of:
enabled: false
disabledUrl: "http://localhost:3006/order"
All environment variables are provided a default to work with your local cluster in config.js
except;
OIDC_CLIENT_SECRET
and COOKIE_SECRET
Update your .env
file in project root with values that are mentioned below:
NODE_ENV=development LOGGER_LEVEL=debug OIDC_CLIENT_SECRET=SampleClientSecret COOKIE_SECRET=secret squirrel REDIS_PORT=6380
Run the app with npm run start:dev
Application should now be running on http://localhost:3006/order/.
Create a .env
file in the root of the project.
Look at the Dependencies
section to run each app on your local machine.
Update the .env
file to point to dependencies
Start local redis in your terminal run npm run start:redis
this will run your local redis on port 6380
Add REDIS_PORT=6380
to you .env
file
On a separate terminal run the app with npm run start:dev
Application should now be running on http://localhost:3006/order/.
- In Visual Studio Code, go to Preferences > Settings and search for 'node debug' and turn the 'Auto Attach' option ON.
- Insert breakpoint/s.
- In Visual Studio Code, open the integrated terminal and run
npm run debug
Identity Server. Order Form API.
Run the jest unit test with npm run test
.
Run the UI component tests with npm run test:ui
.
To run both unit and UI tests, run
npm run test:all
.
Run the integration tests with npm run test:integration
by default this will run the integration tests in 2 threads.
npm run test:integration b=chrome
-> changes the browser to run as chrome. Default set to chrome:headless
npm run test:integration p=catalogue=solutions/dashboard
-> Will run the 3 ui.test files within this page directory
npm run test:integration p=catalogue=solutions/dashboard f=general
-> Will run the general.ui.test within this page directory
Right click on the test file and copy the path.
npm run test:integration fp={{path-to-app}}/order-form/app/pages/sections/order-items/catalogue-solutions/dashboard/ui-tests/general.ui.test.js c=1
npm run test:integration c=4
-> Run all the ui tests in 4 threads. Default is 2
These flags can be used together. So if you want to run a single ui.test file in chrome in a single thread then it will be something like this;
npm run test:integration b=chrome p=catalogue=solutions/dashboard f=general c=1
The order of these flags do not matter like they used to.