@tryghost/webhook-mock-receiver 2.0.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,8 +8,7 @@ Up to date documentation about the usage of the module available in [End-to-end
8
8
 
9
9
  or
10
10
 
11
- `yarn add @tryghost/webhook-mock-receiver`
12
-
11
+ `pnpm add @tryghost/webhook-mock-receiver`
13
12
 
14
13
  ## Purpose
15
14
 
@@ -17,29 +16,24 @@ Test utility for mocking webhook endpoints and asserting captured payload/header
17
16
 
18
17
  ## Usage
19
18
 
20
-
21
19
  ## Develop
22
20
 
23
- This is a mono repository, managed with [lerna](https://lernajs.io/).
21
+ This is a mono repository, managed with [Nx](https://nx.dev).
24
22
 
25
23
  Follow the instructions for the top-level repo.
26
- 1. `git clone` this repo & `cd` into it as usual
27
- 2. Run `yarn` to install top-level dependencies.
28
24
 
25
+ 1. `git clone` this repo & `cd` into it as usual
26
+ 2. Run `pnpm install` to install top-level dependencies.
29
27
 
30
28
  ## Run
31
29
 
32
- - `yarn dev`
33
-
30
+ - `pnpm dev`
34
31
 
35
32
  ## Test
36
33
 
37
- - `yarn lint` run just eslint
38
- - `yarn test` run lint and tests
39
-
40
-
41
-
34
+ - `pnpm lint` runs oxlint
35
+ - `pnpm test` runs lint and tests
42
36
 
43
- # Copyright & License
37
+ # Copyright & License
44
38
 
45
39
  Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
@@ -1,23 +1,20 @@
1
- const {AssertionError} = require('assert');
2
- const {URL} = require('url');
1
+ const { AssertionError } = require('assert');
2
+ const { URL } = require('url');
3
3
  const nock = require('nock');
4
4
  class WebhookMockReceiver {
5
- constructor({snapshotManager}) {
6
- this.body;
7
- this.headers;
8
- this._receiver;
5
+ constructor({ snapshotManager }) {
9
6
  this.snapshotManager = snapshotManager;
10
7
  this.recordRequest = this.recordRequest.bind(this);
11
8
  }
12
9
 
13
10
  recordRequest(body, options) {
14
- this.body = {body};
15
- this.headers = {headers: options.headers};
11
+ this.body = { body };
12
+ this.headers = { headers: options.headers };
16
13
  }
17
14
 
18
15
  async receivedRequest() {
19
16
  // @NOTE: figure out a better waiting mechanism here, don't allow it to hang forever
20
- const {default: pWaitFor} = await import('p-wait-for');
17
+ const { default: pWaitFor } = await import('p-wait-for');
21
18
  await pWaitFor(() => this._receiver.isDone());
22
19
  }
23
20
 
@@ -36,7 +33,7 @@ class WebhookMockReceiver {
36
33
  // let the nock continue with the response
37
34
  return true;
38
35
  })
39
- .reply(200, {status: 'OK'});
36
+ .reply(200, { status: 'OK' });
40
37
 
41
38
  return this;
42
39
  }
@@ -54,7 +51,7 @@ class WebhookMockReceiver {
54
51
  properties: properties,
55
52
  field: 'body',
56
53
  type: 'body',
57
- error
54
+ error,
58
55
  };
59
56
 
60
57
  this.snapshotManager.assertSnapshot(this.body, assertion);
@@ -68,7 +65,7 @@ class WebhookMockReceiver {
68
65
  properties: properties,
69
66
  field: 'headers',
70
67
  type: 'header',
71
- error
68
+ error,
72
69
  };
73
70
 
74
71
  this.snapshotManager.assertSnapshot(this.headers, assertion);
package/package.json CHANGED
@@ -1,34 +1,32 @@
1
1
  {
2
2
  "name": "@tryghost/webhook-mock-receiver",
3
- "version": "2.0.3",
3
+ "version": "2.2.0",
4
+ "license": "MIT",
5
+ "author": "Ghost Foundation",
4
6
  "repository": {
5
7
  "type": "git",
6
8
  "url": "git+https://github.com/TryGhost/framework.git",
7
9
  "directory": "packages/webhook-mock-receiver"
8
10
  },
9
- "author": "Ghost Foundation",
10
- "license": "MIT",
11
- "main": "index.js",
12
- "scripts": {
13
- "dev": "echo \"Implement me!\"",
14
- "test": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
15
- "lint:code": "eslint *.js lib/ --ext .js --cache",
16
- "lint": "yarn lint:code && yarn lint:test",
17
- "lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache",
18
- "posttest": "yarn lint"
19
- },
20
11
  "files": [
21
12
  "index.js",
22
13
  "lib"
23
14
  ],
15
+ "main": "index.js",
24
16
  "publishConfig": {
25
17
  "access": "public"
26
18
  },
19
+ "dependencies": {
20
+ "p-wait-for": "6.0.0"
21
+ },
27
22
  "devDependencies": {
28
23
  "got": "14.6.6",
29
- "sinon": "21.0.2"
24
+ "sinon": "21.1.2"
30
25
  },
31
- "dependencies": {
32
- "p-wait-for": "6.0.0"
26
+ "scripts": {
27
+ "dev": "echo \"Implement me!\"",
28
+ "test": "NODE_ENV=testing vitest run --coverage",
29
+ "lint": "oxlint -c ../../.oxlintrc.json .",
30
+ "posttest": "pnpm run lint"
33
31
  }
34
- }
32
+ }