declarative-nock
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -48,2 +48,5 @@ /* | ||
}): void; | ||
addJestHooks({ disableNetConnect, }?: { | ||
disableNetConnect?: boolean; | ||
}): void; | ||
} |
@@ -95,3 +95,20 @@ /* | ||
} | ||
addJestHooks({ disableNetConnect = true, } = {}) { | ||
beforeAll(() => { | ||
this.installMocks(); | ||
if (disableNetConnect) { | ||
debug('disableNetConnect'); | ||
this.nock.disableNetConnect(); | ||
} | ||
}); | ||
afterAll(() => { | ||
this.removeMocks(); | ||
if (disableNetConnect) { | ||
debug('enableNetConnect'); | ||
this.nock.enableNetConnect(); | ||
} | ||
}); | ||
afterEach(() => this.resetAll()); | ||
} | ||
} | ||
exports.DeclarativeNock = DeclarativeNock; |
{ | ||
"name": "declarative-nock", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Declarative Nock", | ||
@@ -68,2 +68,3 @@ "license": "BSD-3-Clause", | ||
"@types/debug": "^4.1.7", | ||
"@types/jest": "^29.2.0", | ||
"@types/mocha": "^9.0.1", | ||
@@ -70,0 +71,0 @@ "@types/node": "^15.12.4", |
[![nlm-github](https://img.shields.io/badge/github-groupon%2Fdeclarative--nock%2Fissues-F4D03F?logo=github&logoColor=white)](https://github.com/groupon/declarative-nock/issues) | ||
![nlm-node](https://img.shields.io/badge/node-%3E%3D12-blue?logo=node.js&logoColor=white) | ||
![nlm-version](https://img.shields.io/badge/version-1.0.1-blue?logo=version&logoColor=white) | ||
![nlm-version](https://img.shields.io/badge/version-1.1.0-blue?logo=version&logoColor=white) | ||
# `declarative-nock` | ||
@@ -95,2 +95,3 @@ | ||
addMochaHooks(opts?: { disableNetConnect: boolean = true }): void; | ||
addJestHooks(opts?: { disableNetConnect: boolean = true }): void; | ||
} | ||
@@ -144,2 +145,7 @@ ``` | ||
#### `addJestHooks({ disableNetConnect = true })` | ||
Exactly like `addMochaHooks()` except calls `beforeAll()` and `afterAll()` | ||
instead of `before()` and `after()` to work with Jest. | ||
#### `nock` | ||
@@ -146,0 +152,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39027
34
596
373
24