Skip to content

Commit d30433f

Browse files
Initial tests (#17)
* Add ALL the testing tools! * Integrate a couple more eslint plugins * First test! Yay! * First pass testing most of the checkers * Set up an action for running tests * "actioino" != "action" * Fix more typos. Because spelling is important. * Apply suggestions from code review Co-authored-by: msluther <[email protected]> * Remove explicit linting since it's in posttest now * Add some documentation on writing/running tests Co-authored-by: msluther <[email protected]>
1 parent 1b75cd7 commit d30433f

File tree

6 files changed

+5969
-261
lines changed

6 files changed

+5969
-261
lines changed

.eslintrc

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
22
"root": true,
3-
"extends": "godaddy"
3+
"extends": [
4+
"godaddy",
5+
"plugin:mocha/recommended"
6+
],
7+
"plugins": [
8+
"eslint-plugin-mocha",
9+
"eslint-plugin-node"
10+
],
11+
"env": {
12+
"node": true
13+
}
414
}

.github/workflows/node.js.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [12.x, 14.x, 15.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- name: Install, build, and run tests
29+
run: |
30+
npm ci
31+
npm run build --if-present
32+
npm test
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v1
35+
with:
36+
file: coverage/cobertura-coverage.xml

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ does have the side effect that, if an internal username is connected to multiple
117117
GitHub usernames, as demonstrated above, all of those GitHub usernames will be
118118
made admins of the org.
119119

120+
## Development
121+
122+
### Running Tests
123+
124+
This project uses [mocha], [assume], and [sinon] for its tests. It also uses
125+
[eslint] for ensuring code styling. Luckily, the execution of these tools is
126+
nicely automated for you. To run all of them, all you need to do is:
127+
128+
```console
129+
$ npm test
130+
```
131+
132+
This will run all of the tests for you, followed by the linter.
133+
120134
## Credits
121135

122136
Originally developed internally for making easier work of the management of
@@ -125,8 +139,11 @@ Originally developed internally for making easier work of the management of
125139
* [Joey Wilhelm]
126140
* [Rick Markins]
127141

128-
[TOML]: https://toml.io/
129142
[array of tables]: https://toml.io/en/v1.0.0#array-of-tables
143+
[assume]: http://assume.fail/
130144
[GoDaddy]: https://www.godaddy.com/
131145
[Joey Wilhelm]: https://github.com/tarkatronic/
146+
[mocha]: https://mochajs.org/
132147
[Rick Markins]: https://github.com/rxmarbles/
148+
[sinon]: https://sinonjs.org/
149+
[TOML]: https://toml.io/

0 commit comments

Comments
 (0)