@pactflow/pact-msw-adapter
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -5,2 +5,9 @@ # Changelog | ||
### [3.0.1](https://github.com/pactflow/pact-msw-adapter/compare/v3.0.0...v3.0.1) (2024-12-10) | ||
### Bug Fixes | ||
* Fix the cleanup of expired request listeners ([264ac15](https://github.com/pactflow/pact-msw-adapter/commit/264ac1561a0b3ef3e4eb88e85406316723738e48)) | ||
## [3.0.0](https://github.com/pactflow/pact-msw-adapter/compare/v2.0.1...v3.0.0) (2023-11-09) | ||
@@ -7,0 +14,0 @@ |
@@ -10,3 +10,3 @@ import { PactFile, MatchedRequest } from "./pactMswAdapter"; | ||
excludeHeaders: string[] | undefined; | ||
} | undefined; | ||
}; | ||
}) => Promise<PactFile>; |
@@ -42,4 +42,4 @@ /// <reference types="node" /> | ||
options: PactMswAdapterOptions; | ||
worker?: SetupWorker | undefined; | ||
server?: SetupServer | undefined; | ||
worker?: SetupWorker; | ||
server?: SetupServer; | ||
}) => PactMswAdapter; | ||
@@ -46,0 +46,0 @@ export { convertMswMatchToPact }; |
@@ -52,3 +52,2 @@ "use strict"; | ||
const activeIdx = activeRequestIds.indexOf(requestId); | ||
emitter.emit("pact-msw-adapter:expired", expired); | ||
if (activeIdx >= 0) { | ||
@@ -59,2 +58,3 @@ // Could be removed if completed or the test ended | ||
} | ||
emitter.emit("pact-msw-adapter:expired", expired); | ||
}, options.timeout); | ||
@@ -205,3 +205,3 @@ }); | ||
const events = [ | ||
"pact-msw-adapter:expired ", | ||
"pact-msw-adapter:expired", | ||
"pact-msw-adapter:match", | ||
@@ -208,0 +208,0 @@ "pact-msw-adapter:new-test", |
{ | ||
"name": "@pactflow/pact-msw-adapter", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"main": "./dist/pactMswAdapter.js", | ||
@@ -46,18 +46,18 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.23.2", | ||
"@pact-foundation/pact": "^12.1.0", | ||
"@types/jest": "^29.5.7", | ||
"@typescript-eslint/eslint-plugin": "^6.9.1", | ||
"@typescript-eslint/parser": "^6.9.1", | ||
"@babel/preset-env": "^7.23.3", | ||
"@pact-foundation/pact": "^12.1.2", | ||
"@types/jest": "^29.5.12", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.19.0", | ||
"axios": "^1.6.0", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^8.52.0", | ||
"eslint": "^8.56.0", | ||
"jest": "^29.7.0", | ||
"msw": "^2.0.2", | ||
"nock": "^13.3.7", | ||
"regenerator-runtime": "^0.14.0", | ||
"msw": "^2.0.14", | ||
"nock": "^13.5.1", | ||
"regenerator-runtime": "^0.14.1", | ||
"rimraf": "^5.0.5", | ||
"standard-version": "^9.5.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -64,0 +64,0 @@ "dependencies": { |
@@ -19,5 +19,2 @@ # pact-msw-adapter | ||
[![Publish and release](https://github.com/pactflow/pact-msw-adapter/actions/workflows/publish.yml/badge.svg)](https://github.com/pactflow/pact-msw-adapter/actions/workflows/publish.yml) | ||
[![Linux](https://svgshare.com/i/Zhy.svg)](https://svgshare.com/i/Zhy.svg) | ||
[![macOS](https://svgshare.com/i/ZjP.svg)](https://svgshare.com/i/ZjP.svg) | ||
[![Windows](https://svgshare.com/i/ZhY.svg)](https://svgshare.com/i/ZhY.svg) | ||
@@ -125,2 +122,42 @@ Check out the [quick start guide](https://docs.pactflow.io/docs/bi-directional-contract-testing/tools/msw). | ||
## Log output | ||
You can create your own instance of a `Logger`, the default is a [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console) | ||
If one wishes to suppress the output from pact-msw-adapter, you could use the following `emptyConsole` function. | ||
```js | ||
const emptyConsole = () => { | ||
const emptyFunction = () => {}; | ||
const emptyConsole = { | ||
log: emptyFunction, | ||
debug: emptyFunction, | ||
info: emptyFunction, | ||
warn: emptyFunction, | ||
error: emptyFunction, | ||
group: emptyFunction, | ||
groupCollapsed: emptyFunction, | ||
groupEnd: emptyFunction, | ||
}; | ||
return emptyConsole; | ||
} | ||
``` | ||
Pass the custom console to the `options.logger` key in `setupPactMswAdapter` | ||
```js | ||
import { PactFile, setupPactMswAdapter } from "./pactMswAdapter"; | ||
const server = setupServer(); | ||
const pactMswAdapter = setupPactMswAdapter({ | ||
server, | ||
options: { | ||
...options, | ||
logger: emptyConsole() | ||
}, | ||
}); | ||
``` | ||
_Note:_ - This will not control or affect msw's native logging. | ||
## Pact files generation | ||
@@ -127,0 +164,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
46971
304