36 Commits

Author SHA1 Message Date
chris48s
504015c0ba migrate hapi/joi to joi (#5624)
* update joi + joi-extension-semver

* @hapi/joi --> joi

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-09-30 17:51:02 +00:00
Caleb Cartwright
ac54dd3ced convert some service classes to static props, run [drone dub dynamic] (#5543)
* refactor(drone): convert to static props

* refactor(dub): convert to static props

* refactor(dynamic): convert to static props
2020-09-15 01:42:57 +00:00
Pierre Grimaud
8ceb4f2c31 Fix typos in comments (#5102) 2020-05-19 21:23:13 +01:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
Paul Melnikow
5b42c8310b [dynamicjson] Fix unexpected token in JSONPath query (#4984)
Includes a test.

Fixes #4988
2020-04-30 23:19:39 -04:00
dependabot-preview[bot]
478d14300c Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2 (#4859)
* Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.20.1 to 2.20.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.20.1...v2.20.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fixes

* refactor: combine imports

* refactor: combine imports

* refactor: combine imports

* refactor: update import ordering

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: Paul Melnikow <email@paulmelnikow.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Caleb Cartwright <caleb.cartwright@outlook.com>
2020-04-16 18:39:13 -05:00
Marcin Mielnicki
22a85bfbcd A response size metric of an upstream service for dynamic badges like [dynamicyaml], (but not [jetbrains]) (#4434)
* Response size metric for all services

* Unused code removed

* Test for service response size metric

* All buckes of the service_response_bytes in a comment

* Register parameter in PrometheusMetrics is optional

* service response size metric enabled for dynamic badges

* Better test name

* JSDoc removed

* One import from one file

* Gather metrics in the background

* Revert saving response time metrics in the background
2020-01-04 17:48:24 +01:00
Marcin Mielnicki
dfcb6defc8 Refactor JSONPath based services, run [DynamicJson DynamicYaml] (#4272)
* Subclass factory for JSON path services

* Common methods moved to JSON path class

* should throw error if _getData is not overridden

* Test JSON path factory using chai-as-promised

* Using chai-as-promised in more tests

* JSDoc for json-path

* Error message adopted to JSON and YAML

* Dynamic YAML badge handles YAML with a string

* 'fetch' naming covention

* Strict string validation in error message
2019-12-05 01:03:05 +01:00
Marcin Mielnicki
4c159eff00 Support for XPath functions in [dynamicxml] badge (#4153)
* Support XPath query with type convertion

* Support XPath query with node function

* Parametrized tests for transform function

* Handle unusual values returned by 'select'
2019-10-12 17:23:17 +02:00
Caleb Cartwright
65f66642dd fix type errors in [DynamicXml] service (#4041)
* fix: type errors in DynamicXml service

* tests: add more tests for DynamicXml

* tests: another DynamicXml service test
2019-10-08 15:48:43 -05:00
Paul Melnikow
23ac2b0318 Fix AssertionError in [DynamicJson] when a non-object is in the JSON (#4024)
Closes #4018
2019-09-15 17:05:02 +00:00
chris48s
873172522f [dynamicxml] wrap xpath errors (#3955)
Closes #3796
2019-09-07 13:02:27 -04:00
Paul Melnikow
ab7a2106b5 Handle [DynamicJson] parse error (#3783)
Close #3781
2019-07-25 11:35:31 -05:00
Paul Melnikow
ead56cdf49 [DynamicJson] Catch jsonpath parse error (#3776)
Closes #3772
2019-07-24 22:07:23 -05:00
dependabot-preview[bot]
294aa1e1df Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0; autofixes (#3671)
* Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Autofixes
2019-07-08 12:13:46 -04:00
chris48s
8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00
Paul Melnikow
d343fddb2c Rewrite [dynamicxml] tests, and fix issue with attribute filters (#3298)
This fixes queries with an attribute filter in the middle, such as //book[@id='bk102']/title.

Close #3089
2019-04-13 15:06:36 -04:00
Pierre-Yves B
25f8541e5b JSON format modernisation and _shields_test removal (#3272)
* Modernised JSON format and removed _shields_test style

* Added logoWidth and labelColor fields to JSON response

* Reinstated and updated comment

* Extended expectBadge to accept Joi schemas for all fields
2019-04-07 18:57:55 +01:00
Pierre-Yves B
1f29c22d3d Migrated most service tests to use new expectBadge (#3122) 2019-02-28 21:43:23 +00:00
Paul Melnikow
4bd16f93e8 Sort imports and requires (#3056)
This will definitely save time, and ensure more uniformity.

It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.

Closes #2701
2019-02-21 22:14:40 -05:00
Paul Melnikow
33aefcfaf8 Minor cleanup related to colorB -> color (#3066)
As `color` is now the canonical, it makes sense to update some of these tests to say `colorB` instead.

Ref #3012
2019-02-20 23:34:22 -05:00
Paul Melnikow
2d7be31b0c Validate query params in BaseService (#3042)
This is a mid-sized PR that adds query param validation to BaseService and updates most of the services which use query param validation to use it. There are a couple minor tweaks I made along the way.

Fix #2676
2019-02-20 22:24:47 -05:00
Paul Melnikow
8c478d0e0a Use normalized colors to fix [dynamic matrix nexus] service tests (#2958) 2019-02-08 00:49:27 -05:00
Caleb Cartwright
855c9cd261 Remove dev dep imports in production code (#2937)
Fixes #2876 with @paulmelnikow's suggestion 

Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
2019-02-05 21:51:55 -05:00
Paul Melnikow
ef5c36dcb4 Remove some obsolete .networkOff() tests (#2932) 2019-02-05 21:23:24 +00:00
Paul Melnikow
7c3bca1ab7 Refactor endpoint functions (#2909) 2019-02-03 17:29:52 -05:00
Paul Melnikow
226fa67a02 Create shortcut for BaseService-related imports (#2809)
Continue to implement #2698:

- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
2019-01-21 15:41:24 -05:00
Paul Melnikow
4597d77015 Refactor badge color functions (#2742)
- Replace the idea of color schemes with the idea of named colors (since none of our colorschemes have used `colorA`)
- Pass through the normalized color to `_shields_test` to harmonize with BaseService and simplify testing
    - Update service tests
- Move responsibility for color generation into the npm package
- Remove several color helper functions and their tests
- Update gh-badge public API to accept `color` and `labelColor`

This is a precursor to refactoring some of the logo code for #2473.
2019-01-15 16:43:33 -05:00
Paul Melnikow
cd0ff105f6 User color should not override error color (#2693)
Fix #1446.
2019-01-09 16:32:28 -05:00
Jan Keromnes
3ab2862922 Fix a few typos (#2697)
* Fix typos (using 'codespell -w')

* Properly capitalize Git and GitHub in TUTORIAL.md
2019-01-08 12:08:50 -05:00
Paul Melnikow
4a976b52ea Fix import issue with [dynamic] badge (#2578)
Ref https://github.com/badges/shields/pull/2519#issuecomment-449511750
2018-12-23 10:13:04 -05:00
Paul Melnikow
382af10506 Rewrite [GithubManifest] and [GithubPackageJson] badges (#2470)
Pave the way for #2259 and rewrite #1721 along the way.

Ref: #2320
2018-12-19 16:33:20 -05:00
chris48s
b5ac5d6044 [dynamicyaml f-droid] add yaml base service class (#2540) 2018-12-16 20:29:20 +00:00
Paul Melnikow
b8461aa921 Rewrite [DynamicXml] and [DynamicYaml] badges (#2487)
- A little related cleanup in `server.js`: remove a couple import renames.
2018-12-12 16:52:47 -05:00
Paul Melnikow
8a8311d931 Unify and minimize tester boilerplate (#2472)
I started using this one-line boilerplate a while back and it seems to tidy things up a bit.
2018-12-08 13:15:24 -05:00
Paul Melnikow
6a737b7b38 Rewrite the DynamicJson badge (#2399)
This starts the rewrite of the dynamic badges. I've pulled into BaseService an initial version of the query param validation from #2325.

I've extended from BaseJsonService to avoid duplicating the deserialization logic, though it means there is a bit of duplicated code among the three dynamic services. The way to unravel this would be to move the logic from `_requestJson` and friends from the base classes into functions so DynamicJson can inherit from BaseDynamic. Would that be worth it?

This introduces a regression of #1446 for this badge.

Close #2345
2018-12-06 16:45:40 -05:00