• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gr2m / octokit-fixtures
79%
master: 100%

Build:
Build:
LAST BUILD BRANCH: travis-avoid-double-builds
DEFAULT BRANCH: master
Repo Added 05 Sep 2017 03:06AM UTC
Files 18
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH mock-explain-and-pending
branch: mock-explain-and-pending
CHANGE BRANCH
x
Reset
  • mock-explain-and-pending
  • 20/remove-now-proxy-header
  • coveralls-ci
  • cron/fixtures-changes/2017-09-22
  • fix/put-patch-requests-with-empty-body
  • fix/set-ids-to-1
  • get-organization
  • greenkeeper/coveralls-3.0.0
  • greenkeeper/semantic-release-8.0.0
  • install-nock-from-npm
  • master
  • next
  • node-4-compatibility
  • readme-introduction-video
  • rename-package
  • scenario/add-and-remove-repository-collaborator
  • travis-avoid-double-builds

pending completion
101

push

travis-ci

gr2m
feat: `mock.pending()` and `mock.explain(error)`

For tests, you can check if all mocks have been satisfied for a given scenario

```js
const mock = fixtures.mock("api.github.com/get-repository")
// send requests ...
mock.done() // will throw an error unless all mocked routes have been called
mock.pending() // returns array of pending mocks in the format [<method> <path>]
```

`mock.explain` can be used to amend an error thrown by nock if a request could
not be matched

```js
const mock = fixtures.mock("api.github.com/get-repository")
const github = new GitHub()
return github.repos.get({owner: "octokit-fixture-org", repo: "hello-world"})
.catch(mock.explain)
```

Now instead of logging

```
Error: Nock: No match for request {
  "method": "get",
  "url": "https://api.github.com/orgs/octokit-fixture-org",
  "headers": {
    "host": "api.github.com",
    "content-length": "0",
    "user-agent": "NodeJS HTTP Client",
    "accept": "application/vnd.github.v3+json"
  }
}
```

The log shows exactly what the difference between the sent request and the next
pending mock is

```diff
 Request did not match mock:
 {
   headers: {
-    accept: "application/vnd.github.v3"
+    accept: "application/vnd.github.v3+json"
   }
 }
```

15 of 30 branches covered (50.0%)

Branch coverage included in aggregate %.

107 of 124 relevant lines covered (86.29%)

4.63 hits per line

Relevant lines Covered
Build:
Build:
124 RELEVANT LINES 107 COVERED LINES
4.63 HITS PER LINE
Source Files on mock-explain-and-pending
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
101 mock-explain-and-pending feat: `mock.pending()` and `mock.explain(error)` For tests, you can check if all mocks have been satisfied for a given scenario ```js const mock = fixtures.mock("api.github.com/get-repository") // send requests ... mock.done() // will throw an e... push 19 Sep 2017 05:49AM UTC gr2m travis-ci pending completion  
See All Builds (119)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc