Add a missing call and missing options to nock index.d.ts (#35166)

* Bumped ver to 10.0.1

nock.activeMocks() is missing => added function activeMocks(): string[]; to the nock namespace.
nock( 'https://api.github.com' , {"encodedQueryParams":true}) => added encodedQueryParams: boolean to the Options interface.

* Updated per previous comments

However, I don't know what this error is that is causing Travis CI to fail???
```
Error: ../node/v7/index.d.ts: Definitions must use global references to other packages, not parent ("../xxx") references.(Based on reference 'base.d.ts')
```

* Update tests for activeNocks

* Dedent/remove 'function' from activeMocks in Scope interface

* linter changes
This commit is contained in:
tagyoureit
2019-05-08 11:12:10 -07:00
committed by Jesse Trinity
parent 900439b8b7
commit cb425140db
2 changed files with 7 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ declare namespace nock {
function isActive(): boolean;
function isDone(): boolean;
function pendingMocks(): string[];
function activeMocks(): string[];
function removeInterceptor(interceptor: Interceptor | RequestOptions): boolean;
function disableNetConnect(): void;
function enableNetConnect(matcher?: string | RegExp): void;
@@ -81,6 +82,7 @@ declare namespace nock {
isDone(): boolean;
restore(): void;
pendingMocks(): string[];
activeMocks(): string[];
}
interface Interceptor {
@@ -113,6 +115,7 @@ declare namespace nock {
reqheaders?: { [key: string]: string | RegExp | { (headerValue: string): boolean; }; };
badheaders?: string[];
filteringScope?: { (scope: string): boolean; };
encodedQueryParams?: boolean;
}
interface RequestOptions {

View File

@@ -604,6 +604,10 @@ if (!scope.isDone()) {
}
console.error('pending mocks: %j', nock.pendingMocks());
/// .activeMocks()
nock.activeMocks(); // $ExpectType string[]
nock('http://example.com').activeMocks(); // $ExpectType string[]
// Logging
google = nock('http://google.com').log(console.log);