You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-10
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ See the [issue list](https://github.com/DoESLiverpool/optimism/issues) for what
11
11
NOTE: You'll need to be using `npm` version 7 or above for this to work, **and** version 14 or *earlier* of NodeJS because `node-sass` does not support version 16 yet.
12
12
13
13
1. Install the dependencies `npm install`
14
-
1. Set up the database `npx knex migrate:latest` (or if there have been any changes to the database structure, this will run the migrations)
14
+
1. Set up the database `npx knex migrate:latest --knexfile ./api/knexfile.js` (or if there have been any changes to the database structure, this will run the migrations)
15
15
1. Create a `.env` file in this folder. This will hold any configuration options you need to set. For a basic development setup this should suffice:
16
16
````
17
17
OPTIMISM_API_PORT = 3001
@@ -20,20 +20,24 @@ NOTE: You'll need to be using `npm` version 7 or above for this to work, **and**
20
20
21
21
OPTIMISM_ENABLE_DETAILED_ERROR_MESSAGES = 1
22
22
````
23
-
1. [Optional] Populate the development database with some sample data: `npx knex seed:run --env development` (**WARNING: this will delete any data in the database already**)
23
+
1. [Optional] Populate the development database with some sample data: `npx knex seed:run --env development --knexfile ./api/knexfile.js` (**WARNING: this will delete any data in the database already**)
24
24
25
25
## Script commands
26
26
27
27
The following commands are defined in package.json:
"dev": "concurrently -n \"website,api,sass\" \"npm run website\" \"npm run api\" \"npm run css-watch\""
38
+
}
36
39
```
40
+
`npm run test-api` runs the API tests
37
41
38
42
`npm run website` starts the website (by running website/app.js)
39
43
@@ -45,9 +49,8 @@ The following commands are defined in package.json:
45
49
46
50
`npm run css-watch` watches optimisim.scss and compiles it if it changes
47
51
48
-
`npm run dev-all` concurrently starts the website, api and css-watch
52
+
`npm run dev` concurrently starts the website, api and css-watch
49
53
50
-
`npm run test` (or `npm tests` or `npm t`) runs .js files in the test subfolder. You can use one of the existing files e.g. app.test.js as a template (first set the NODE_ENV environment variable to 'testing' and run `npx knex install:latest` to use the latest version of the test database)
51
54
52
55
The `nodemon` commmand is used to monitor code changes in each of the website and api projects and restart these as required.
53
56
@@ -74,3 +77,7 @@ Their interactions are orchestrated with `docker-compose`, so getting it running
74
77
To run any database migrations, once things are running then run: `docker-compose exec api npx knex migrate:latest --env production`
75
78
76
79
Any time things are pushed to the `master` branch, the [live site will automatically deploy the new version](https://github.com/DoESLiverpool/optimism/issues/48).
These live in the ./api/test folder. To run them, use:
6
+
7
+
`npm run test-api`
8
+
9
+
The tests are currently integration tests only. They test the API endpoints against a running instance of the API. This is still a WIP and will eventually test endpoints for correct return values including returning appropriate HTTP response codes on failure.
10
+
11
+
Unit tests are TODO.
12
+
13
+
14
+
## Website tests
15
+
16
+
TODO
17
+
18
+
Still to be finalised but Cypress may be our choice of front-end testing framework. Tests can be run manually or as part of CI/CD.
0 commit comments