Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service tests #937

Merged
merged 59 commits into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a74d96d
Cherry-pick some test helpers
paulmelnikow Apr 8, 2017
2d0ae03
Integrate vendor tests
paulmelnikow Apr 8, 2017
645c233
Allow running a single test suite
paulmelnikow Apr 8, 2017
dacaa41
Minor doc cleanup
paulmelnikow Apr 8, 2017
17627cb
More doc
paulmelnikow Apr 8, 2017
112f30e
Pull icedfrisby-nock from npm
paulmelnikow Apr 12, 2017
cf96bf1
Merge branch 'master' into vendor-tests
paulmelnikow Apr 12, 2017
60787a3
Make only() work as intended
paulmelnikow Apr 12, 2017
e8d59b8
Merge branch 'master' into vendor-tests
paulmelnikow Apr 13, 2017
fc2565e
Add coverage script
paulmelnikow Apr 13, 2017
b08bea1
Add tutorial on writing vendor tests, first pass
paulmelnikow Apr 13, 2017
f764a25
Edits to the readme
paulmelnikow Apr 13, 2017
1d86c50
Readme: Add a complete example
paulmelnikow Apr 13, 2017
ef082d2
Reorder sections
paulmelnikow Apr 13, 2017
04625c0
Merge branch 'master' into vendor-tests
paulmelnikow Apr 13, 2017
fa13c8e
Enable test for 404 badge now that #922 is merged
paulmelnikow Apr 13, 2017
2fc06f5
Unfork icedfrisby
paulmelnikow Apr 15, 2017
dedce45
Bump is-png to check the entire PNG signature
paulmelnikow Apr 16, 2017
1f070a0
Add a section for tests in the tutorial
niccokunzmann Apr 14, 2017
1b297f7
comment on boiler plate code
niccokunzmann Apr 14, 2017
8500314
Add experimental slack notification
paulmelnikow Apr 17, 2017
b7bb5c4
Merge branch 'master' into vendor-tests
paulmelnikow Apr 17, 2017
54c4a11
Refactor runner
paulmelnikow Apr 17, 2017
2be3e76
Move common test helpers into test/
paulmelnikow Apr 17, 2017
a1b5918
Run tagged vendor tests in PRs
paulmelnikow Apr 17, 2017
f35d17b
Tweak comment style + misc
paulmelnikow Apr 17, 2017
897ffac
Actually run these from PRs + cron
paulmelnikow Apr 17, 2017
a7c8c4f
Use the correct repo slug
paulmelnikow Apr 17, 2017
bf318c0
Add symlink in doc/
paulmelnikow Apr 17, 2017
8b14abe
Explain why the dev should not call toss()
paulmelnikow Apr 17, 2017
5e9ec62
Explain why we’re using rust
paulmelnikow Apr 17, 2017
555251d
Explain Joi.equal()
paulmelnikow Apr 17, 2017
5ae0dcd
Explain require('joi')
paulmelnikow Apr 17, 2017
001a07e
review motivation section
niccokunzmann Apr 14, 2017
1002045
Annotate the vendor code
paulmelnikow Apr 17, 2017
ebec4b1
Try to diagnose failures in PRs
paulmelnikow Apr 17, 2017
c90658a
Remove spurious return
paulmelnikow Apr 17, 2017
c741d17
Add some comments
paulmelnikow Apr 17, 2017
f6023fa
Update coverage script
paulmelnikow Apr 18, 2017
7cc2406
Minor style cleanup
paulmelnikow Apr 18, 2017
de59114
Use networkOff() and clean up reliably
paulmelnikow Apr 18, 2017
285db59
Try to add a second Slack token
paulmelnikow Apr 18, 2017
7d997b3
Clarify the arguments to ServiceTester
paulmelnikow Apr 19, 2017
ddeb832
Rm symlink
paulmelnikow Apr 19, 2017
cd5c70a
Use function decls
paulmelnikow Apr 19, 2017
0bd15a7
Clarify about choosing Rust
paulmelnikow Apr 19, 2017
34d0c5c
vendor -> service-tests
paulmelnikow Apr 19, 2017
e5a37ae
Alphabetize requires
paulmelnikow Apr 19, 2017
a61b931
More function decls
paulmelnikow Apr 19, 2017
6a3521f
Add a comment to clarify
paulmelnikow Apr 19, 2017
c9df451
Parse args once
paulmelnikow Apr 19, 2017
f7ad7da
Don’t pass extra arguments from map()
paulmelnikow Apr 19, 2017
a55465b
uniq -> Set
paulmelnikow Apr 19, 2017
43585c0
Prevent calling start() more than once
paulmelnikow Apr 19, 2017
6ad2171
vendor -> services in travis.yml
paulmelnikow Apr 19, 2017
509e332
Missed vendor -> service
paulmelnikow Apr 19, 2017
7f307f2
Use node-fetch
paulmelnikow Apr 25, 2017
d9e0196
Clean lint
paulmelnikow Apr 25, 2017
71458a6
Merge branch 'master' into vendor-tests
paulmelnikow Apr 28, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
instrumentation:
excludes: ['lib/suggest.js', 'vendor/**/*.js']
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_js:
script:
- npm run lint
- npm run test:js
- if [ "$TRAVIS_EVENT_TYPE" == cron ]; then npm run test:services; fi
- if [ "$TRAVIS_EVENT_TYPE" == pull_request ]; then npm run test:services -- --pr; fi

branches:
except:
Expand All @@ -14,6 +16,12 @@ notifications:
email:
- thaddee.tyl@gmail.com
irc: "irc.freenode.org#shields"
slack:
rooms:
# One builds on badges/shields, the other for paulmelnikow/shields
secure: VyTRZfcRAIrYTgfYG5RNJrKd0boDYNBfWEhzm20aLJvDeI2TgwAB2bSClkjjBe9KD3vlEjW6WbOdXfc/pBEdiIYgxl0vjg1qv3qJLJ4a6oacJg3UukJim28SucxZL2yhyseahHt12HyuPdUtwy+QzhJRp6Jo7T7M7ClKh0/qI4M=
secure: Z494jqFmkiIrBEmhTW7zKTlewskUo/lFCs/IWgEA/zUUEPHIDYNJjjE47Lkd7WlKoD3k2Cpb5/HJ8vwXAGmOdMG7JAxzlL0etJYLgrE/MJ0+TDDAj9jCyS6G5OUzxAbcThSadQgC8umtQmZ+IzEyo2rBPh5VknfL/SN4QS8L83f8mdo/JKnfYR81Z05g+CXfBWQALDJzlRT0nzgSSWUjrIJKMCNlvpNnL/rrAeHhc1eYernUsZpiOVJVlkMWxuBmQHwntWp7aV9/yCuzz5w+tlYlHwYJySE2JP3LUb9z0vuueYL1YEXQMdcBcvb3SLBg1ZUPRKk+OwEI4U1U002BOZnr/uIqYGsAWL90W6AfjVA2mNwf0wMgD981SZLuqovZadvQ3+hxjl0oyb8eVc4uDXnKyrCuwI4gqc/T6RomfCs1bXlHsQrGp03l0IT5ADkzfTDS0VFHYYB5Og3cJodC0SF/m2s9ZnEhMtWnTdz4sOhRFV1GccODI+5lz6F/XVdaY2zon9zkRjpoZKXsjCpPMc/OTXKVwV90Y0vots3vlyaO3eJvlH/qkFkZyavHeSSl9vo50QUfcVGY5AgoNuaKwz4RwzklGTsW06TV4jHpw8SMBnapNDVziMUzSQ4nUvQYtJofmpxT2K/2JImtIyfvO489uQZjgr5WkXaPMUaGWdc=
on_success: change

git:
depth: 10
Expand Down
21 changes: 20 additions & 1 deletion doc/TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,24 @@ Edit [try.html][tryhtml] in the right section (Build, Downloads, ...) and add yo

Save, restart and you can see it [locally][try].

## (4.4) Write Tests

When creating a badge for a new service or changing a badge's behavior, tests
should be included. They serve several purposes:

1. They speed up future contributors when they are debugging or improving a
badge.
2. If a contributors like to change your badge, chances are, they forget
edge cases and break your code.
Tests may give hints in such cases.
3. The contributor and reviewer can easily verify the code works as
intended.
4. When a badge stops working on the live server, maintainers can find out
right away.

There is a dedicated [tutorial for tests in the service-tests folder][tests-tutorial].
Please follow it to include tests on your pull-request.

## (5) Create a Pull Request

You have implemented changes in `server.js`, `try.html` and `index.html`.
Expand Down Expand Up @@ -249,4 +267,5 @@ These files can also be of help for creating your own badge.
[new-badge]: https://github.com/badges/shields/pulls?q=is%3Apr+label%3Anew-badge
[docker-example]: https://github.com/badges/shields/blob/bf373d11cd522835f198b50b4e1719027a0a2184/server.js#L5014
[travis-example]: https://github.com/badges/shields/blob/bf373d11cd522835f198b50b4e1719027a0a2184/server.js#L431
[regex]: https://www.w3schools.com/jsref/jsref_obj_regexp.asp
[regex]: https://www.w3schools.com/jsref/jsref_obj_regexp.asp
[tests-tutorial]: ../service-tests/#readme
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
"xml2js": "~0.4.16"
},
"scripts": {
"coverage:test:js": "istanbul cover _mocha 'test/**/*.spec.js' --dir coverage/js",
"coverage:test:services": "istanbul cover _mocha --delay service-tests/runner/cli.js --dir coverage/services",
"coverage:test": "npm run coverage:test:js && npm run coverage:test:services",
"coverage:report": "istanbul report",
"coverage:report:reopen": "opn coverage/lcov-report/index.html",
"coverage:report:open": "npm run coverage:report && npm run coverage:report:reopen",
"lint": "eslint '**/*.js'",
"test:js": "mocha 'test/**/*.spec.js'",
"test:services": "mocha --delay service-tests/runner/cli.js",
"test": "npm run lint && npm run test:js"
},
"bin": {
Expand All @@ -56,9 +63,17 @@
],
"devDependencies": {
"eslint": "^3.18.0",
"is-png": "^1.0.0",
"glob": "^7.1.1",
"icedfrisby": "^1.1.0",
"icedfrisby-nock": "^0.3.0",
"is-png": "^1.1.0",
"is-svg": "^2.1.0",
"istanbul": "^0.4.5",
"lodash.difference": "^4.5.0",
"mocha": "^3.2.0",
"nock": "^9.0.13",
"node-fetch": "^1.6.3",
"opn-cli": "^3.1.0",
"sinon": "^2.1.0"
}
}
Loading