Install Node 8. https://nodejs.org/en/
Update to use the latest npm npm i -g npm
git clone git@github.com:bbc/simorgh.git
npm install
To run this application locally, with hot-reloading, run: npm run dev.
The application will start on http://localhost:7080/. These is a single route, /.
To run locally npm run storybook, it will then be available at http://localhost:9001/. Introduction to and documentation for Storybook is here: https://storybook.js.org/basics/introduction/.
To run this application locally with a production build, run:
npm run build && npm run start
We have linting with the Airbnb styleguide and we use Prettier as a code formatter. They can be run with npm run test:lint.
We have Jest unit tests that can be run with npm run test:unit.
npm test runs both sets of these.
We use Cypress for our end-to-end tests. For running the tests locally, run this single command:
npm run test:e2e
It will spin up a production server on port 7080 and run the Cypress tests against that.
Further details on using the Cypress CLI can be found at https://docs.cypress.io/guides/guides/command-line.html
Cypress can be run interactively using npm run test:e2e:interactive. This loads a user interface which easily allows for indivdual tests to be run alongside a visual stream of the browser, as the tests run.
We also have a Cypress project which runs a different set of end-to-end tests on Storybook. For running the tests locally we need two terminals running:
npm run storybookwith the application,npm run test:storybookwith the Cypress integration tests.
We use Lighthouse to test the performance of our page. For running the tests locally we need two terminals running:
- Start the production server
npm run lighthouseruns our Lighthouse tests.
Lighthouse will output html reports to the reports folder. It will also open a HTML report in your browser allowing an individual to clearly see the best practice score of the page along with the audits that were run against it.