Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/colinrobertbrooks/testing-javascript-applications-demo
A demo app with static analysis and unit/integration/end-to-end tests ๐งช
https://github.com/colinrobertbrooks/testing-javascript-applications-demo
end-to-end-testing integration-testing javascript nodejs reactjs testing unit-testing
Last synced: about 8 hours ago
JSON representation
A demo app with static analysis and unit/integration/end-to-end tests ๐งช
- Host: GitHub
- URL: https://github.com/colinrobertbrooks/testing-javascript-applications-demo
- Owner: colinrobertbrooks
- License: mit
- Created: 2018-11-06T17:57:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-04T17:22:37.000Z (almost 4 years ago)
- Last Synced: 2023-02-27T03:32:25.400Z (over 1 year ago)
- Topics: end-to-end-testing, integration-testing, javascript, nodejs, reactjs, testing, unit-testing
- Language: JavaScript
- Homepage: https://colinrobertbrooks.github.io/blog/testing-javascript-applications/
- Size: 426 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Testing Javascript Applications Demo
A demo app with static analysis and unit/integration/end-to-end tests. Read more about it [here](https://colinrcummings.github.io/blog/testing-javascript-applications/).
[![Build Status](https://travis-ci.com/colinrcummings/testing-javascript-applications-demo.svg?branch=master)](https://travis-ci.com/colinrcummings/testing-javascript-applications-demo)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/colinrcummings/testing-javascript-applications-demo.svg?style=flat-square)](https://codecov.io/github/colinrcummings/testing-javascript-applications-demo/)## System Requirements
- [git](https://git-scm.com/) v2.14.1 or greater
- [node](https://nodejs.org/) v8.9.4 or greater
- [npm](https://www.npmjs.com/) v5.6.0 or greater## Setup
```
git clone https://github.com/colinrcummings/testing-javascript-applications-demo.git
cd testing-javascript-applications-demo
npm run setup
```## About the app
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.
## Running the app
### Development
Optimized for DX.
```
npm run db:reset:dev
npm run start:dev
```Visit [localhost:3000](http://localhost:3000/); login with username "admin" and password "password".
### Test
Optimized for end-to-end testing (see below).
```
npm run db:reset:test
npm run build:test
npm run start:test
```Visit [localhost:3000](http://localhost:3000/); login with username "cypress" and password "password".
### Production
Optimized for UX.
```
npm run db:init
npm run build
npm start
```Visit [localhost:80](http://localhost:80/); login with username "admin" and password "password".
## Running tests
_Scripts included in the `precommit` and `validate` scripts are indicated below._
### Static Analysis
Run [eslint](https://eslint.org/) 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](https://prettier.io/) 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
```### Unit & Integration
Run [jest](https://jestjs.io/) 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](https://istanbul.js.org/) (included in the `validate` script):
```
npm run coverage
```### End-to-end
Run [cypress](https://www.cypress.io/) 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._