A demo app with static analysis and unit/integration/end-to-end tests. Read more about it here.
git clone https://github.com/colinrcummings/testing-javascript-applications-demo.git
cd testing-javascript-applications-demo
npm run setup
This app has a home page, a login page and a series of feature pages (Feature 1 and Feature 2) for authorized users. Users can be created, updated and destroyed by admin users on the Manage Users page.
Optimized for DX.
npm run db:reset:dev
npm run start:dev
Visit localhost:3000; login with username "admin" and password "password".
Optimized for end-to-end testing (see below).
npm run db:reset:test
npm run build:test
npm run start:test
Visit localhost:3000; login with username "cypress" and password "password".
Optimized for UX.
npm run db:init
npm run build
npm start
Visit localhost:80; login with username "admin" and password "password".
Scripts included in the precommit
and validate
scripts are indicated below.
Run eslint against the codebase for a list of exceptions (staged files are checked in the precommit
script; all files are checked in the validate
script):
npm run lint
Run prettier against the codebase for a list of exceptions (staged files are checked in the precommit
script; all files are checked in the validate
script):
npm run format:check
Run prettier against the codebase and automatically fix exceptions:
npm run format:fix
Run jest tests (included in the precommit
script):
npm run test
Run jest tests in watch mode:
npm run test:watch
Run jest tests and generate code coverage via istanbul (included in the validate
script):
npm run coverage
Run cypress tests in headless mode (included in the validate
scripts):
npm run test:e2e
Run cypress tests in interactive mode:
test:e2e:interactive
Both commands reset the database, generate a build and start the server first.