Commit Graph

90 Commits

Author SHA1 Message Date
Paul Melnikow
dc44ba7725 Clean up request-handler, github-auth, and analytics; upgrade to Mocha 4 (#1142)
- Add tests to request-handler to prepare for some tweaks to caching for #820
- Clean up code in request-handler: renames, DRY, arrows, imports
- Allow for clean shutdown of `setInterval` code. This requires the ability to cancel autosaving.
- Upgrade to Mocha 4, and clean up so the process exits on its own (see mochajs/mocha#3044)
- Better encapsulate analytics
2017-10-17 22:01:46 -04:00
Paul Melnikow
6edb198334 Optimize standard npm start script for dev usage (#1157)
- `make setup` (i.e. `make`) in the dev tutorial seems an unnecessary step. Badges will load from my local server after a clone, as long as I open try.html.
2017-10-16 23:41:27 -04:00
Paul Melnikow
4020929482 Upgrade dot (#1168)
Reviewing the commits, it doens’t appear anything of significance has changed.
2017-10-16 20:15:05 +02:00
Paul Melnikow
7f385fb361 Upgrade dev dependencies, clean lint (#1151)
Looks like eslint 4 adds `no-useless-escape` and `no-self-compare` to `eslint:recommended`.
2017-10-12 15:57:29 -04:00
Paul Melnikow
200bb11ed3 Upgrade dependencies (#1149)
These don’t appear to make any API changes that affect us.
2017-10-12 15:55:29 -04:00
Paul Melnikow
4f48031551 Upgrade coverage CLI from istanbul to nyc (#1148)
Per a note posted to the istanbul readme in May, this version of istanbul is deprecated.

https://github.com/gotwarlost/istanbul
2017-10-11 13:53:24 -04:00
Paul Melnikow
d48ebe2636 Upgrade IcedFrisby to version supporting only() (#1143) 2017-10-10 11:19:47 -04:00
Ben Gundersen
8f802f6230 Add [Wordpress] theme support (#1138)
- Added badges for Wordpress theme downloads (total) and theme rating
- Add missing dev dependency (minimist)

Close #869
2017-10-10 11:02:42 -04:00
Paul Melnikow
271bb4b99c Add tests for [npm] version (#1128) 2017-10-09 14:52:52 -04:00
Paul Melnikow
2809ff6888 Configure prettier and eslint-config-standard (#1123) 2017-10-09 14:46:30 -04:00
Paul Melnikow
bb66a99a66 [GitHub] Issue and pull request detail and check state (#1114)
This adds badges for Github issues and pull requests. You can display the state, title, username, number of comments, age, time since last update, and state of checks.

Provides an endpoint the Shields CI can use to fetch PR titles for #979 and resolves #1011.
2017-10-02 13:26:42 -04:00
Paul Melnikow
8e08b374a4 [Github] Last commit date and commit activity (#1112)
Reopen of #928 by mskonovalov. Closes #897.
2017-10-02 10:47:14 -04:00
Paul Melnikow
0068f31af2 In PR's, exclusively run the designated service tests e.g. [cran discord] (#1111)
The intended behavior of the bracketed [github], [bower], [discord] service names in the pull request title is to trigger the designated service tests. That way, affected services can be proven working during code review, without needing to run tests on a dev machine, nor running all the slow (and flaky) service tests.

Example pull request titles:

- [Travis] Fix timeout issues
- [Travis Sonar] Support user token authentication
- [CRAN CPAN CTAN] Add test coverage

The observed behavior is that, whenever bracketed service names are provided, all of the service tests run.

This is due to a Mocha limitation, which is that exclusive tests (it.only and describe.only) can only be applied synchronously. In other words, if we try to fetch the PR title and then add exclusive tests in the callback, all the tests will run anyway. This is true even when using _mocha --delay, as we are, and is true whether I use request or node-fetch.

Undoubtedly this could be fixed, though it's not worth it. The problem is obscure and therefore low priority for Mocha, which is quite backlogged.

And, there is an easy workaround, which is to generate the list of services to test in a separate process.

The pull request script test:services:pr is now split into two parts. First the :prepare script infers the pull request context, fetches the PR title, and writes the list of affected services to a file. Then the :run script reads the list of affected services and runs the appropriate tests.

In addition to sidestepping the Mocha bug, this setup makes it easier to reason about and debug these two steps of the test runner on a dev machine, and since I can't get pipefail to work – and want to be able to run the steps separately – I'm not using Node's built in pre scripts.

Overall, separating these concerns this makes the test runner easier to reason about.
2017-10-01 20:03:29 -04:00
RedSparr0w
76a963369a Fix Windows coverage errors
Provide relative path to `_mocha`
2017-09-27 20:22:31 -04:00
Paul Melnikow
8e6fe01d20 Add test for measure-text 2017-09-24 22:36:14 +02:00
Paul Melnikow
852784b1a2 Fetch Bower data using libraries.io (#919)
- Avoid downloading bower packages via git
- Service is well resourced: https://libraries.io/team
- Same service used by https://bower.io/search/
2017-09-17 23:55:07 +02:00
Paul Melnikow
80ace97bb0 Bump icedfrisby-nock to stable release (#986) 2017-05-04 09:47:13 -07:00
Andre Caetano
a6d81f2391 [Github] File size badge (#745)
Closes #730
2017-05-01 14:28:45 -04:00
Paul Melnikow
653f79fbde Tests: Convert to ES6, use node-fetch, refactor, and clean up style (#971) 2017-04-30 10:51:18 -04:00
Paul Melnikow
8233a0ba38 Fix service coverage script and linting (#975)
* Fix "callback is not a function" in coverage:test:services

* Don't lint /coverage
2017-04-29 17:31:07 -07:00
Thaddee Tyl
e17c15c00b Set the coverage npm script to use current specs
The coverage script was introduced in 5c147b8d91,
and the spec files were moved in c3ef232bf7.

Also, correct a small typo.
2017-04-28 16:39:17 -04:00
Paul Melnikow
bd8a04141e Record minimum Node version 2017-04-28 21:16:08 +02:00
Paul Melnikow
c3ef232bf7 Place tests alongside their code (#969)
Reorg of the tests: move them just alongside their code. The principle relates to grouping by coupling, not by function and is established in best-practice documents (e.g. https://github.com/focusaurus/express_code_structure#underlying-principles-and-motivations), despite its break from the tradition of a separate `test/` tree. All of today's tools can handle tests spread through the repository.

There are some good, if subtle consequences of this change:

- Since files are close at hand, friction is reduced at development time, which encourages that new tests are written to cover new behaviors.
- It's easier to find the tests that cover a particular piece of functionality.
- It's easier to see which code has tests and which doesn't.
2017-04-28 00:55:15 -04:00
Paul Melnikow
5c147b8d91 Service tests (#937)
- Eliminate manual testing which is error-prone and time consuming, and must be repeated many times through the PR review process
- Make contributing more fun. For many, fixing bugs and making new badges is faster and more satisfying with automated tests than with manual testing.
- Push out the work of testing new badges to a much broader net. The PR originator could write tests, but so could any other contributor who wants to push review along.
- Detect badge failures resulting from changes in vendor contracts without waiting for user reports.
- Detect and prevent regressions in the code.
- Be runnable, readable, writable, and editable by as many developers as possible, including those who may not be familiar with JavaScript test tools.

-- @paulmelnikow, @niccokunzmann, @Daniel15
2017-04-27 23:13:14 -04:00
anatoly techtonik
65fc2a7f56 Update request to 2.81.0 (#961)
Fix deprecated uuid warning
2017-04-25 23:47:48 -04:00
Paul Melnikow
0760d17d82 Return data from svg2img via callback
Given the chunks coming from imagemagick are getting stored memory and
then tucked into a cache, this function could as easily return a buffer
via callback. Streaming is just making it more complex. (And trickier to
test!)
2017-04-12 23:13:16 +02:00
Paul Melnikow
ad1e419d42 Add tests for svgToImg 2017-04-12 23:13:16 +02:00
Paul Melnikow
3905424d1c Add a test for badge.js and refactor 2017-04-12 23:13:16 +02:00
Paul Melnikow
076bd384d5 Use a glob pattern instead of hard-coding filenames 2017-03-30 00:18:30 +02:00
Paul Melnikow
5f945d4856 Use Mocha to make tests more reliable 2017-03-30 00:18:30 +02:00
Thaddee Tyl
11b6e06f2f Organize local modules in lib 2017-03-26 22:57:55 +02:00
Paul Melnikow
47a8bf51dc First pass for linting on PRs 2017-03-20 16:54:27 -04:00
Thaddee Tyl
7c8b0e3d32 Contain all private files in private/ 2017-02-05 16:24:35 +01:00
Federico Zivolo
ef1a51590e Use gm instead of phantom to create pngs 2017-01-29 19:14:31 +01:00
Thaddee Tyl
2b63d62242 Re-remove the ass testing dependency
It was mistakenly added by 2cb82a4a.
2016-11-20 18:53:51 +01:00
Józef Sokołowski
2cb82a4ab3 Add Mozilla Addons support 2016-10-30 10:47:56 +01:00
Peter Dave Hello
6c21450c46 bump dependencies 2016-10-10 16:52:01 +08:00
Thaddee Tyl
7ea0d811a5 Allow specifying a custom font path in the library 2016-09-07 07:24:58 +01:00
Thaddee Tyl
cf8fdd91fb Add measure-text.js to npm files
Fixes #758.
2016-08-07 09:29:51 +02:00
Thaddee Tyl
f6ee6745cd npm 1.2.2: another bugfix camp update 2016-06-26 16:20:42 +02:00
Thaddee Tyl
2875ecedbc npm 1.2.1: camp update to allow undefined error in catchpath 2016-06-26 15:41:49 +02:00
Thaddee Tyl
68b105cd3e npm v1.2.0
Removed needless libraries.
2016-06-14 08:27:33 +02:00
Thaddee Tyl
6349c5c24a Put all test-related files in test/ 2016-06-14 08:26:57 +02:00
Thaddee Tyl
e3a9ae9411 Convert tests to assert
ass seems outdated and outpaced.
2016-06-12 17:39:36 +02:00
Thaddee Tyl
c4924f0d9f Upgrade to node 6
We no longer need to require Promise.
2016-06-12 15:00:29 +02:00
Thaddee Tyl
61306975ef Omit needless promise package 2016-06-12 14:55:28 +02:00
Thaddee Tyl
c403e367f7 Synchronize saved GitHub user tokens
Issue #529.

Having a server down breaks the process currently. That will be addressed in a
later commit.
2016-06-01 00:15:45 +02:00
Thaddee Tyl
419483f24e Transmit and save GitHub user tokens
Issue #529.
2016-05-28 22:33:34 +02:00
Thaddee Tyl
ccaacfc408 Support GitHub OAuth user authentication
Issue #529.
2016-05-21 21:34:35 +02:00
Thaddee Tyl
78721d7728 Upgrade phantomjs
Fixes https://github.com/badges/shields/issues/645#issuecomment-217222593.
2016-05-05 20:08:21 +02:00