Commit Graph

2260 Commits

Author SHA1 Message Date
Mehmet Seçkin
54569e9668 [AzureDevOpsTests] Refactor unit tests to improve stability (#2454)
* Correct regex generation logic

* Refactor variable name

* Mock Azure DevOps test result summary API

* Add live tests

Updated mocked tests to use expected values for assertion. Added live
tests to test the API. Added `no tests` as an acceptable result for live
tests.

* Declare common nock setup functions to avoid repetition
2018-12-05 11:04:15 -05:00
Paul Melnikow
16c798a65c Fix [travis] php-v tests (#2457)
See failures: https://circleci.com/gh/badges/shields/26998

It looks like the bug is in the original regex: #1372.
2018-12-04 19:37:18 -05:00
chris48s
37d27a8e6a couples of fixes to docs on porting legacy services (#2456)
- use the right issue no and link to it
- fix the trace command example
2018-12-04 22:17:42 +00:00
Paul Melnikow
a35e877391 Modernize some examples teamcity azuredevops travis [uptimerobot vaadin vscode-marketplace] (#2444)
Ref #1961
2018-12-04 16:44:30 -05:00
Paul Melnikow
986d215c18 Modernize some more examples (#2447)
Ref #1961
2018-12-04 16:23:13 -05:00
chris48s
bca9df2560 don't run service tests on master (#2392) 2018-12-04 19:43:17 +00:00
dependabot[bot]
7c0df62706 Bump nock from 10.0.2 to 10.0.3 (#2450)
Bumps [nock](https://github.com/nock/nock) from 10.0.2 to 10.0.3.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v10.0.2...v10.0.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-04 19:40:54 +00:00
Monica Bui
ec07f23942 Add [StackExchange] monthly questions badge service (#2432)
- Badge shows number of questions for a given library for the previous month (not current month because its in progress)
- Service works for not just the StackOverflow site but for other StackExchange sites also

Close #2378
2018-12-03 20:12:44 -05:00
Paul Melnikow
99e846d2ab Link together some of the documentation (#2446) 2018-12-03 18:05:34 -05:00
Paul Melnikow
809ecf73b9 Examples: Drop deprecated aliases query, urlPattern (#2443) 2018-12-03 16:30:12 -05:00
dependabot[bot]
4f83015732 Bump fast-xml-parser from 3.12.9 to 3.12.10 (#2442)
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.12.9 to 3.12.10.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-03 21:01:04 +00:00
Paul Melnikow
07d8572ffe Add static examples for [Node] (#2409)
Ref #1961
2018-12-03 15:55:26 -05:00
Paul Melnikow
919eed6c0f Remove longCache from static examples (#2440)
- `longCache` should not be appearing in the displayed URLs for the usage examples.
- `maxAge` is ignored for static badges.
2018-12-03 15:41:44 -05:00
Mehmet Seçkin
e8c411b6f9 Add Azure DevOps tests service (#2412)
Added a test results badge service for an Azure Pipelines build using the ResultSummaryByBuild endpoint. Added basic unit tests for the service.

Close #2411
2018-12-03 08:58:37 -05:00
Paul Melnikow
e3ad57d8fe Add tips for rewriting legacy services (#2429) 2018-12-03 00:27:12 -05:00
Pierre-Yves B
0a6afb4478 Added tests for Sourcegraph service (#2439) 2018-12-02 17:41:01 +00:00
Paul Melnikow
59fdd8a5b0 TokenPool: Add debug logging helper + return correct error (#2400)
Slice another sliver from #1205.
2018-12-02 11:28:21 -05:00
Tair Assimov
88294563cc Deprecate dockbit service - discontinued (#2410)
Ref: #2344
2018-12-02 11:26:10 -05:00
Paul Melnikow
2045489019 Service definition export format (#2397)
Three main goals:

1. In the front end:
      a. Show form fields and automatically assemble badge URLs (#701)
      c. Group together examples for the same service
      b. Show deprecated services
2. Make it easy to changing the schema of `examples`, thanks to 100% validation. One challenge with frameworks is that when there are typos things fail silently which is pretty unfriendly to developers. The validation should really help with that. (This caught one bug in AUR, though I fixed it in #2405 which landed first.)
3. Produce a service definition export for external tool builders. (#776)
4. Build toward harmony between the front-end data structure and the `examples` key in the service classes. I aliased `staticPreview` to `staticExample` which starts this process.

The old format:

- Lacked a consistent machine-readable representation of the fields.
- Flattened multiple examples for the same service were flattened.
- Excluded deprecated services.

The new format improves a few things, too:

- It cleans up the naming. Since this file evolved over time, the names were a bit muddled (i.e. what was an example vs a preview).
- It duplicated information (like `.svg`). (I can imagine dropping the `.svg` from our badge URLs someday, which would make the URLs easier to read and maintain.)
- For a human reading the YAML file, providing the static example as a deconstructed object is more readable.

Here are a couple snippets:

```yml
  - category: build
    name: AppVeyorCi
    isDeprecated: false
    route:
      format: '([^/]+/[^/]+)(?:/(.+))?'
      queryParams: []
    examples:
      - title: AppVeyor
        example: {path: /appveyor/ci/gruntjs/grunt, queryParams: {}}
        preview: {label: build, message: passing, color: brightgreen}
        keywords: []
      - title: AppVeyor branch
        example: {path: /appveyor/ci/gruntjs/grunt/master, queryParams: {}}
        preview: {label: build, message: passing, color: brightgreen}
        keywords: []
  - category: downloads
    name: AmoDownloads
    isDeprecated: false
    examples:
      - title: Mozilla Add-on
        example: {path: /amo/d/dustman, queryParams: {}}
        preview: {path: /amo/d/dustman, queryParams: {}}
        keywords: [amo, firefox]
```
2018-12-02 11:21:30 -05:00
Pierre-Yves B
658086bc46 Tests for [Pub] service (#2436) 2018-12-02 10:08:21 +00:00
Paul Melnikow
74aef34b77 Modernize [AzureDevops] examples (#2406) 2018-12-01 18:01:19 -05:00
chris48s
e20c7c8b14 show dynamic badge examples with a base (#2438)
this makes them a bit nicer to copy & paste
2018-12-01 21:55:18 +00:00
Paul Melnikow
2ec2c00787 Fix [LibrariesioDependencies] for project names containing dots (#2434)
Close #2424
2018-12-01 16:05:54 -05:00
Paul Melnikow
0aee712738 Fix crash in legacy service (#2437)
Bug in #2360
2018-12-01 15:10:32 -05:00
Paul Melnikow
54a36e9474 Refactor cache-header handling and config, create NonMemoryCachingBaseService, rewrite [flip] (#2360)
There's a lot going on in this PR, though it's all interdependent, so the only way I can see to break it up into smaller pieces would be serially.

1. I completely refactored the functions for managing cache headers. These have been added to `services/cache-headers.js`, and in some ways set the stage for the rest of this PR.

    - There are ample higher-level test of the functionality via `request-handler`. Refactoring these tests was deferred. Cache headers were previously dealt with in three places:
        - `request-handler.js`, for the dynamic badges. This function now calls `setCacheHeaders`.
        - `base-static.js`, for the static badges. This method now calls the wordy `serverHasBeenUpSinceResourceCached` and `setCacheHeadersForStaticResource`.
        - The bitFlip badge in `server.js`. 👈 This is what set all this in motion. This badge has been refactored to a new-style service based on a new `NoncachingBaseService` which does not use the Shields in-memory cache that the dynamic badges user.
    - I'm open to clearer names for `NoncachingBaseService`, which is kind of terrible. Absent alternatives, I wrote a short essay of clarification in the docstring. 😝 

2. In the process of writing `NoncachingBaseService`, I discovered it takes several lines of code to instantiate and invoke a service. These would be duplicated in three or four places in production code, and in lots and lots of tests. I kept the line that goes from regex to namedParams (for reasons) and moved the rest into a static method called `invoke()`, which instantiates and invokes the service. This _replaced_ the instance method `invokeHandler`.
    - I gently reworked the unit tests to use `invoke` instead of `invokeHandler`– generally for the better.
    - I made a small change to `BaseStatic`. Now it invokes `handle()` async as the dynamic badges do. This way it could use `BaseService.invoke()`.

3. There was logic in `request-handler` for processing environment variables, validating them, and setting defaults. This could have been lifted whole-hog to `services/cache-headers.js`, though I didn't do that. Instead I moved it to `server-config.js`. Ideally `server-config` is the only module that should access `process.env`. This puts the defaults and config validation in one place, decouples the config schema from the entire rest of the application, and significantly simplifies our ability to test different configs, particularly on small units of code. (We were doing this well enough before in `request-handler.spec`, though it required mutating the environment, which was kludgy.) Some of the `request-handler` tests could be rewritten at a higher level, with lower-level data-driven tests directly against `cache-headers`.
2018-12-01 13:57:34 -05:00
Paul Melnikow
17e57b4155 Add static examples to a few legacy services [travis david coveralls amo] (#2407)
It seems useful to accelerate #1961 even as the badge rewrites are still underway. This introduces a small amount of technical debt by hard-coding the static example, though continuing this work could allow us to eliminate the old ways of specifying examples. It seems like a decent tradeoff.
2018-12-01 13:52:49 -05:00
dependabot[bot]
18b95cba5a Bump snap-shot-it from 6.2.5 to 6.2.7 (#2421)
Bumps [snap-shot-it](https://github.com/bahmutov/snap-shot-it) from 6.2.5 to 6.2.7.
- [Release notes](https://github.com/bahmutov/snap-shot-it/releases)
- [Commits](https://github.com/bahmutov/snap-shot-it/compare/v6.2.5...v6.2.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-01 14:50:09 +00:00
dependabot[bot]
41b05b3320 Bump prettier from 1.15.2 to 1.15.3 (#2433)
Bumps [prettier](https://github.com/prettier/prettier) from 1.15.2 to 1.15.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/1.15.2...1.15.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-01 14:40:30 +00:00
anatoly techtonik
07063fd1be TUTORIAL.md: Service handles requests to external APIs (#2422) 2018-11-29 20:08:20 -05:00
Monica Bui
3b3dd9fb1b Fix URL pattern for [StackExchange] Questions and Reputation per PR #2418 (#2430)
* Fix URL pattern for StackExchange Questions and Reputation per #2418

Url patterns have been changed back to their older legacy format.
Tests now run properly with this URL in addition to the examples
showing up on local.

* Make changes per review comments. Also change "q" to "t" parameter to match legacy url for questions
2018-11-29 19:07:31 -05:00
Paul Melnikow
bff4f83818 Rewrite [ElmPackage] (#2403)
Ref #1358
2018-11-29 17:38:49 -05:00
dependabot[bot]
24c0b9c7e7 Bump danger from 6.1.5 to 6.1.8 (#2416)
Bumps [danger](https://github.com/danger/danger-js) from 6.1.5 to 6.1.8.
- [Release notes](https://github.com/danger/danger-js/releases)
- [Changelog](https://github.com/danger/danger-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/danger/danger-js/compare/6.1.5...6.1.8)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-29 22:29:31 +00:00
dependabot[bot]
4da2fa3aa9 Bump fast-xml-parser from 3.12.8 to 3.12.9 (#2395)
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.12.8 to 3.12.9.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-29 22:26:51 +00:00
Paul Melnikow
8d19f78363 Rewrite + tweak [Beerpay] (#2404)
Ref #1358
2018-11-29 17:24:29 -05:00
anatoly techtonik
1144dba14a TUTORIAL.md: Mention URL mapping upfront and clarify static meaning (#2425)
* TUTORIAL.md: Mention URL mapping upfront and clarify static meaning

* Be more specific that route is URL

* Explain async without reference to prior knowledge

* Use the same example URL to explain the directory layout

* Clean diff

* `route()` + `static`

- The route includes the base URL, so try to clarify that
- Add some more information about `static`
2018-11-29 14:46:42 -05:00
Monica Bui
9713964812 Port [StackExchange] from legacy to BaseJsonService (#2418)
Per part of issue #2378, convert StackExchange service to the newer
BaseJson class. Refactor also to seperate StackExchange reputation and
questions tag info into new StackExchange subservice files
as the legacy class contained both which may be difficult to keep track
of in the future as the service continues to grow.
More tests have been added to make sure other StackExchange sites besides
StackOverflow will still work with the new badge setup.
2018-11-28 21:40:12 -05:00
Paul Melnikow
43d99f96e6 Fix failing service tests for [bintray npmlicense github crates] (#2401)
Closes #2343 #2348 #2402

Ref: #2345 #1359
2018-11-28 18:54:04 -05:00
Paul Melnikow
77ff19903d Test the notfound routes in server.js (#2398) 2018-11-27 16:36:20 -05:00
Paul Melnikow
c678ca2abd Tweak [AUR] and add static examples (#2405) 2018-11-27 16:34:02 -05:00
Monica Bui
11493d6ab9 Add tests for [StackExchange] (#2414) 2018-11-27 15:55:05 -05:00
dependabot[bot]
1cebdd4bb1 Bump sinon-chai from 3.2.0 to 3.3.0 (#2408)
Bumps [sinon-chai](https://github.com/domenic/sinon-chai) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/domenic/sinon-chai/releases)
- [Commits](https://github.com/domenic/sinon-chai/compare/v3.2.0...3.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-27 10:44:35 -05:00
dependabot[bot]
a524658e74 Bump lint-staged from 8.0.5 to 8.1.0 (#2384)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 8.0.5 to 8.1.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v8.0.5...v8.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-25 21:29:04 +00:00
dependabot[bot]
aed2320d5a Bump joi from 14.0.6 to 14.3.0 (#2393)
Bumps [joi](https://github.com/hapijs/joi) from 14.0.6 to 14.3.0.
- [Release notes](https://github.com/hapijs/joi/releases)
- [Changelog](https://github.com/hapijs/joi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hapijs/joi/compare/v14.0.6...v14.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-25 21:20:47 +00:00
dependabot[bot]
08546544c8 Bump husky from 1.1.4 to 1.2.0 (#2381)
Bumps [husky](https://github.com/typicode/husky) from 1.1.4 to 1.2.0.
- [Release notes](https://github.com/typicode/husky/releases)
- [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
- [Commits](https://github.com/typicode/husky/compare/v1.1.4...v1.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-25 21:14:10 +00:00
Marcin Mielnicki
c72e366895 Run service tests on a given (remote) instance; test on [jetbrains] (#2195)
* Allow to run service tests for remote shields instance

* Allow to run service tests for remote shields instance - doc

* Load testedServerUrl from env variable

* Load 'skipIntercepted' flag from env variable
2018-11-25 15:51:57 +01:00
Pierre-Yves B
72955abac7 Added tests for Package Control service (#2390) 2018-11-25 14:33:05 +00:00
Paul Melnikow
b600bde44e The last of the badge examples (#2389)
* Move PowerShell

* Move Choco + Resharper

* Move MyGet and Nuget
2018-11-25 09:14:54 -05:00
Pierre-Yves B
b9f89d63d8 Added tests for OSS Lifecycle service (#2386) 2018-11-24 19:33:21 +00:00
dependabot[bot]
abec14812c Bump react-dom from 16.6.1 to 16.6.3 (#2374)
Bumps [react-dom](https://github.com/facebook/react) from 16.6.1 to 16.6.3.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/compare/v16.6.1...v16.6.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-24 13:18:26 -05:00
dependabot[bot]
1a75790078 Bump fast-xml-parser from 3.12.7 to 3.12.8 (#2385)
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.12.7 to 3.12.8.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-24 09:40:42 +00:00