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
{{ message }}
This repository was archived by the owner on Dec 10, 2022. It is now read-only.
* dev: (60 commits)
Test cleanups incl. proper naming
Clean up the custom test runner
Complete app.js tests
Minor simplification of eslint config
WIP: Reorganise app.js to make it easier to maintain and easier to test
Clean up and complete all currently remaining tests
WIP: A bunch of Slack message tests
Minor tweaks
Improve test runner to handle user IDs + only make a DB connection if required
devDeps: Add jest-chain for cleaner tests
Minor: make tests more maintainable by just checking that assertions exist
Make eslint output a little cleaner
More Travis tweakin
Try upgrading Travis Slack integration for .com endpoint
Further Travis postgres tweaks
It usually helps to use the correct filename
Docs & CI: mention min. Postgres version & upgrade in Travis
Restructure some tests, adding e2e tests + implementing some Slack test TODOs
Construct test runner for end-to-end tests
Complete Postgres tests
...
Contributions are welcome! [Create an issue](https://github.com/tdmalone/working-plusplus/issues/new) if there's something you'd like to see or [send a pull request](https://github.com/tdmalone/working-plusplus/compare) if you can implement it yourself.
4
+
5
+
## Installing Locally
6
+
7
+
To develop locally against a real, working instance, follow most of the *Installation* instructions in the [README](README.md), except **instead of step 5** (deploying to Heroku), clone this repo locally and then install dependencies:
You'll need [Node.js](https://nodejs.org/) already installed on your system. In addition, if you don't have [Yarn](https://yarnpkg.com/en/) and don't want it, you can use `npm install` instead of `yarn` above (but you might not get _exactly_ the same dependency versions).
14
+
15
+
You'll also need a local installation of PostgreSQL (or a server you can utilise) and a clean database you can use. [Here's an easy-to-use Postgres app for Macs](https://postgresapp.com/). Working PlusPlus++ requires at least PostgreSQL 9.5, but 10+ is recommended.
16
+
17
+
Make the following environment variables accessible to the app:
18
+
19
+
-**`SLACK_BOT_USER_OAUTH_ACCESS_TOKEN`**: from step 4 of the [installation instructions](README.md)
20
+
-**`SLACK_VERIFICATION_TOKEN`**: from step 4 of the [installation instructions](README.md)
21
+
-**`DATABASE_URL`**: in the format `postgres://user@localhost:5432/databasename`
22
+
23
+
Then, run the app:
24
+
25
+
$ node index.js
26
+
27
+
Or if you have the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) installed:
28
+
29
+
$ heroku local
30
+
31
+
ℹ️ _For more help on using `heroku local`, see the [Heroku Local Dev Center article](https://devcenter.heroku.com/articles/heroku-local)._
32
+
33
+
If you make changes to the app, press Ctrl+C to exit, and then run it again.
34
+
35
+
Finally, you'll need to be able to have Slack contact your development instance directly. If you don't have the ability to forward a port through to your machine, I recommend [ngrok](https://ngrok.com/). Download and extract, then in the directory you've extracted it in run:
36
+
37
+
./ngrok http 80 # Or port 5000 if you're running with heroku local.
38
+
39
+
ngrok will provide you with the public URL your app is accessible on. This is the URL you'll then need to use in **step 6** of the [installation instructions](README.md).
40
+
41
+
Other than the modifications to steps 5 and 6, make sure you've followed all the rest of the installation instructions. You should then be set up and ready with a local development instance that you can interact with directly on Slack! If you run into any problems, feel free to [create an issue](https://github.com/tdmalone/working-plusplus/issues/new).
42
+
43
+
## Linting and Running Tests
44
+
45
+
This app has an extensive test suite, just because. Before submitting pull requests, please check that your changes pass linting and tests by running `yarn lint` and `yarn test`. These will also be run for you by Travis CI, but it's often quicker to debug and resolve the issues locally.
46
+
47
+
⚠️ _You will need access to a PostgreSQL server to run the integration and end-to-end tests. If you don't, just run the unit tests (see below) and let Travis CI run the full test suite for you._
48
+
49
+
ℹ️ _If you don't have Yarn, you can replace any mention of `yarn` in this section with `npm run`._
50
+
51
+
You can run just a subset of tests:
52
+
- Unit tests with `yarn unit-tests`
53
+
- Integration tests with `yarn integration-tests`
54
+
- End-to-end tests with `yarn e2e-tests`
55
+
56
+
It is normal to see _some_ errors while running the integration and end-to-end tests, but keep an eye on the exit code of the process to determine if it is successful (run `echo $?` immediately after running `yarn test` - you're looking for an exit code of `0` for a pass).
57
+
58
+
You can modify the default testing behaviour by adjusting the relevant `scripts` in [`package.json`](package.json) or in some cases by passing additional [Jest configuration parameters](https://jestjs.io/docs/en/configuration.html) at the end of the test commands above.
59
+
60
+
If you come across annoying *stylistic* linting rules, feel free to [change them](https://eslint.org/docs/rules/) in [`.eslintrc.js`](.eslintrc.js) as part of your pull request, providing they don't cause an adverse effect on existing code.
61
+
62
+
Many linting issues can be automatically fixed by running `yarn fix`.
Copy file name to clipboardExpand all lines: README.md
+4-38Lines changed: 4 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,45 +76,9 @@ Further instructions, such as hosting elsewhere, upgrading, etc. are coming soon
76
76
77
77
## Contributing
78
78
79
-
Contributions are welcome! [Create an issue](https://github.com/tdmalone/working-plusplus/issues/new) if there's something you'd like to see or [send a pull request](https://github.com/tdmalone/working-plusplus/compare) if you can implement it yourself.
79
+
Your contributions are welcome! [Create an issue](https://github.com/tdmalone/working-plusplus/issues/new) if there's something you'd like to see or [send a pull request](https://github.com/tdmalone/working-plusplus/compare) if you can implement it yourself.
80
80
81
-
To develop locally, follow most of the *Installation* instructions above, except **instead of step 5** (deploying to Heroku), clone this repo locally and then install dependencies:
You'll need [Node.js](https://nodejs.org/) already installed on your system. In addition, if you don't have [Yarn](https://yarnpkg.com/en/) and don't want it, you can use `npm install` instead of `yarn` above (but you might not get _exactly_ the same dependency versions).
88
-
89
-
After installing, to run the app:
90
-
91
-
$ node index.js
92
-
93
-
Or if you have the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) installed:
94
-
95
-
$ heroku local
96
-
97
-
_For more help on running `heroku local`, see the [Heroku Local Dev Center article](https://devcenter.heroku.com/articles/heroku-local)._
98
-
99
-
If you make changes to the app, press Ctrl+C to exit, and then run it again.
100
-
101
-
Finally, you'll need to be able to have Slack contact your development instance directly. If you don't have the ability to forward a port through to your machine, I recommend [ngrok](https://ngrok.com/). Download and extract, then in the directory you've extracted it in run:
102
-
103
-
./ngrok http 80 # Or port 5000 if you're running with heroku local.
104
-
105
-
ngrok will provide you with the public URL your app is accessible on. This is the URL you'll then need to use in **step 6** of the installation instructions above.
106
-
107
-
Other than the modifications to steps 5 and 6, make sure you've followed all the rest of the installation instructions. You should then be set up and ready with a local development instance that you can interact with directly on Slack! If you run into any problems, feel free to [create an issue](https://github.com/tdmalone/working-plusplus/issues/new).
108
-
109
-
### Linting and Running Tests
110
-
111
-
Before submitting pull requests, please check that your changes pass linting and tests by running `yarn lint` and `yarn test`. These will also be run for you by Travis CI, but it's often quicker to debug and resolve the issues locally.
112
-
113
-
You can run just the unit tests with `yarn unit-tests`, and just the integration tests with `yarn integration-tests`. It is normal to see errors while running the integration tests - some of the tests specifically check for these errors - but keep an eye on the exit code of the process to determine if it is successful (run `echo $?` immediately after running `yarn test` - you're looking for an exit code of `0` for a pass.)
114
-
115
-
You can modify the default testing behaviour by adjusting the relevant `scripts` in [`package.json`](package.json) or in some cases by passing additional [Jest configuration parameters](https://jestjs.io/docs/en/configuration.html) on the command line.
116
-
117
-
If you come across annoying *stylistic* linting rules, feel free to [change them](https://eslint.org/docs/rules/) in [`.eslintrc.js`](.eslintrc.js) as part of your pull request, providing they don't cause an adverse effect on existing code. Many linting issues can be automatically fixed by running `yarn fix`.
81
+
For full details on contributing, including getting a local environment set up, see [CONTRIBUTING.md](CONTRIBUTING.md).
118
82
119
83
## TODO
120
84
@@ -133,6 +97,8 @@ Although it works, it's very basic. Potential enhancements include:
133
97
* Option to deduct karma automatically for swearing (with customisable word list?)
134
98
* Record and make accessible how many karma points someone has _given_
135
99
* Enhance messages to support interpolation of variables such as score and name of user or thing **(in progress, see [#1](https://github.com/tdmalone/working-plusplus/pull/1))**
100
+
* Set up a Dockerfile to make local development easier (i.e. to not require Node, Yarn or Postgres)
Copy file name to clipboardExpand all lines: app.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@
18
18
},
19
19
"YARN_PRODUCTION": {
20
20
"description": "This configures Heroku to only install production dependencies. See https://devcenter.heroku.com/articles/nodejs-support#package-installation for more details.",
0 commit comments