@serenity-js/local-server 3.36.1 → 3.37.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/CHANGELOG.md +19 -0
- package/README.md +62 -46
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.37.0](https://github.com/serenity-js/serenity-js/compare/v3.36.2...v3.37.0) (2025-12-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependency express to v5.2.0 [security] ([99a34b3](https://github.com/serenity-js/serenity-js/commit/99a34b3a555324755ae15ba4ea82245c9057adef))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.36.2](https://github.com/serenity-js/serenity-js/compare/v3.36.1...v3.36.2) (2025-11-26)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @serenity-js/local-server
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.36.1](https://github.com/serenity-js/serenity-js/compare/v3.36.0...v3.36.1) (2025-11-16)
|
|
7
26
|
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
# Serenity/JS
|
|
1
|
+
# Serenity/JS Local Server
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40serenity-js%2Flocal-server)
|
|
4
|
+
[](https://github.com/serenity-js/serenity-js/actions)
|
|
5
|
+
[](https://qlty.sh/gh/serenity-js/projects/serenity-js)
|
|
6
|
+
[](https://qlty.sh/gh/serenity-js/projects/serenity-js)
|
|
7
|
+
[](https://github.com/serenity-js/serenity-js/graphs/contributors)
|
|
8
|
+
[](https://snyk.io/test/npm/@serenity-js/local-server)
|
|
9
|
+
[](https://github.com/serenity-js/serenity-js)
|
|
2
10
|
|
|
3
11
|
[](https://www.linkedin.com/company/serenity-js)
|
|
4
12
|
[](https://www.youtube.com/@serenity-js)
|
|
5
13
|
[](https://matrix.to/#/#serenity-js:gitter.im)
|
|
6
14
|
[](https://github.com/sponsors/serenity-js)
|
|
7
15
|
|
|
8
|
-
[Serenity/JS](https://serenity-js.org) is an innovative open-source framework designed to make acceptance and regression testing
|
|
9
|
-
of complex software systems faster, more collaborative and easier to scale.
|
|
10
|
-
|
|
11
|
-
⭐️ Get started with Serenity/JS!
|
|
12
|
-
- [Serenity/JS web testing tutorial](https://serenity-js.org/handbook/web-testing/your-first-web-scenario)
|
|
13
|
-
- [Serenity/JS Handbook](https://serenity-js.org/handbook)
|
|
14
|
-
- [API documentation](https://serenity-js.org/api/)
|
|
15
|
-
- [Serenity/JS Project Templates](https://serenity-js.org/handbook/project-templates/)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- Meet other Serenity/JS developers and maintainers on the [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im),
|
|
19
|
-
- Find answers to your Serenity/JS questions on the [Serenity/JS Forum](https://github.com/orgs/serenity-js/discussions/categories/how-do-i),
|
|
20
|
-
- Learn how to [contribute to Serenity/JS](https://serenity-js.org/community/contributing/),
|
|
21
|
-
- Support the project and gain access to [Serenity/JS Playbooks](https://github.com/serenity-js/playbooks) by becoming a [Serenity/JS GitHub Sponsor](https://github.com/sponsors/serenity-js)!
|
|
17
|
+
[`@serenity-js/local-server`](https://serenity-js.org/api/local-server/) enables Serenity/JS actors to manage local HTTP or HTTPS test servers.
|
|
22
18
|
|
|
23
|
-
##
|
|
19
|
+
## Features
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
[Hapi](https://hapijs.com/),
|
|
27
|
-
[Koa](https://koajs.com/),
|
|
28
|
-
[Restify](http://restify.com/),
|
|
29
|
-
or raw [Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
|
21
|
+
- Supports local servers based on [Express](https://expressjs.com/),
|
|
22
|
+
[Hapi](https://hapijs.com/),
|
|
23
|
+
[Koa](https://koajs.com/),
|
|
24
|
+
[Restify](http://restify.com/),
|
|
25
|
+
or raw [Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
|
26
|
+
- Use it to manage test doubles, mock APIs, or simulate backend services.
|
|
27
|
+
- Works seamlessly with all Serenity/JS test runners
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
To install this module, run the following command in your computer terminal:
|
|
29
|
+
## Installation
|
|
34
30
|
|
|
35
31
|
```sh
|
|
36
32
|
npm install --save-dev @serenity-js/core @serenity-js/local-server
|
|
37
33
|
```
|
|
38
34
|
|
|
35
|
+
See the [Serenity/JS Installation Guide](https://serenity-js.org/handbook/installation/).
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
## Quick Start
|
|
41
38
|
|
|
42
39
|
```typescript
|
|
43
40
|
import { actorCalled } from '@serenity-js/core'
|
|
@@ -66,7 +63,7 @@ await actor.attemptsTo(
|
|
|
66
63
|
|
|
67
64
|
In the above example:
|
|
68
65
|
|
|
69
|
-
1. Import a [`requestListener`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener)
|
|
66
|
+
1. Import a [`requestListener`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener) to use in your test.
|
|
70
67
|
2. Give the [actor](https://serenity-js.org/handbook/design/screenplay-pattern/#actors) an [ability](https://serenity-js.org/handbook/design/screenplay-pattern/#abilities)
|
|
71
68
|
to [`ManageALocalServer`](https://serenity-js.org/api/local-server/class/ManageALocalServer/).
|
|
72
69
|
This enables the interactions to [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/)
|
|
@@ -81,17 +78,18 @@ In the above example:
|
|
|
81
78
|
in an `afterEach` block of your test (or something equivalent)
|
|
82
79
|
to make sure that the server is correctly shut down even when the test fails.
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
Explore practical examples and in-depth explanations in the [Serenity/JS Handbook](https://serenity-js.org/handbook/).
|
|
82
|
+
|
|
83
|
+
## Creating a server
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
`ManageALocalServer` supports any `requestListener` accepted by Node's
|
|
87
86
|
[`http.createServer`](https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener)
|
|
88
|
-
or [`https.createServer`](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener)
|
|
89
|
-
can be used with `ManageALocalServer`.
|
|
87
|
+
or [`https.createServer`](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener).
|
|
90
88
|
|
|
91
89
|
Below are example implementations of a simple HTTP server that would
|
|
92
90
|
satisfy the above test.
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
### Raw Node.js
|
|
95
93
|
|
|
96
94
|
```javascript
|
|
97
95
|
// listener.js
|
|
@@ -103,7 +101,7 @@ module.exports.requestListener = (request, response) => {
|
|
|
103
101
|
|
|
104
102
|
[Learn more about Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
|
105
103
|
|
|
106
|
-
|
|
104
|
+
### Express
|
|
107
105
|
|
|
108
106
|
```javascript
|
|
109
107
|
// listener.js
|
|
@@ -117,7 +115,7 @@ module.exports.requestListener = express().
|
|
|
117
115
|
|
|
118
116
|
[Learn more about Express](https://expressjs.com/).
|
|
119
117
|
|
|
120
|
-
|
|
118
|
+
### HAPI
|
|
121
119
|
|
|
122
120
|
```javascript
|
|
123
121
|
// listener.js
|
|
@@ -131,7 +129,7 @@ module.exports.requestListener = server.listener
|
|
|
131
129
|
|
|
132
130
|
[Learn more about HAPI](https://hapijs.com/).
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
### Koa
|
|
135
133
|
|
|
136
134
|
```javascript
|
|
137
135
|
// listener.js
|
|
@@ -144,7 +142,7 @@ module.exports.requestListener = new Koa()
|
|
|
144
142
|
|
|
145
143
|
[Learn more about Koa](https://koajs.com/).
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
### Restify
|
|
148
146
|
|
|
149
147
|
```javascript
|
|
150
148
|
// listener.js
|
|
@@ -161,20 +159,38 @@ module.exports.requestListener = server
|
|
|
161
159
|
|
|
162
160
|
[Learn more about Restify](http://restify.com/).
|
|
163
161
|
|
|
164
|
-
##
|
|
162
|
+
## Documentation
|
|
165
163
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
- [API Reference](https://serenity-js.org/api/)
|
|
165
|
+
- [Screenplay Pattern Guide](https://serenity-js.org/handbook/design/screenplay-pattern/)
|
|
166
|
+
- [Serenity/JS Project Templates](https://serenity-js.org/handbook/project-templates/)
|
|
167
|
+
- [Tutorial: First Web Scenario](https://serenity-js.org/handbook/tutorials/your-first-web-scenario/)
|
|
168
|
+
- [Tutorial: First API Scenario](https://serenity-js.org/handbook/tutorials/your-first-api-scenario/)
|
|
170
169
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
Contributions of all kinds are welcome! Get started with the [Contributing Guide](https://serenity-js.org/community/contributing/).
|
|
173
|
+
|
|
174
|
+
## Community
|
|
175
|
+
|
|
176
|
+
- [Community Chat](https://matrix.to/#/#serenity-js:gitter.im)
|
|
177
|
+
- [Discussions Forum](https://github.com/orgs/serenity-js/discussions)
|
|
178
|
+
- Visit the [💡How to... ?](https://github.com/orgs/serenity-js/discussions/categories/how-to) section for answers to common questions
|
|
179
|
+
|
|
180
|
+
If you enjoy using Serenity/JS, make sure to star ⭐️ [Serenity/JS on GitHub](https://github.com/serenity-js/serenity-js) to help others discover the framework!
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
The Serenity/JS code base is licensed under the [Apache-2.0](https://opensource.org/license/apache-2-0) license,
|
|
185
|
+
while its documentation and the [Serenity/JS Handbook](https://serenity-js.org/handbook/) are licensed under the [Creative Commons BY-NC-SA 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
|
186
|
+
|
|
187
|
+
See the [Serenity/JS License](https://serenity-js.org/legal/license/).
|
|
188
|
+
|
|
189
|
+
## Support
|
|
175
190
|
|
|
176
|
-
|
|
191
|
+
Support ongoing development through [GitHub Sponsors](https://github.com/sponsors/serenity-js). Sponsors gain access to [Serenity/JS Playbooks](https://github.com/serenity-js/playbooks)
|
|
192
|
+
and priority help in the [Discussions Forum](https://github.com/orgs/serenity-js/discussions).
|
|
177
193
|
|
|
178
|
-
|
|
194
|
+
For corporate sponsorship or commercial support, please contact [Jan Molak](https://www.linkedin.com/in/janmolak/).
|
|
179
195
|
|
|
180
|
-
[](https://github.com/sponsors/serenity-js)
|
|
196
|
+
[](https://github.com/sponsors/serenity-js).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/local-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.37.0",
|
|
4
4
|
"description": "Serenity/JS Screenplay Pattern library for managing local Node.js test servers, including Express, Koa, Hapi, and Restify, to support comprehensive integration testing",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"node": "^20 || ^22 || ^24"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@serenity-js/core": "3.
|
|
60
|
+
"@serenity-js/core": "3.37.0",
|
|
61
61
|
"http-shutdown": "1.2.2",
|
|
62
62
|
"portfinder": "1.0.38"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@hapi/hapi": "^21.4.4",
|
|
66
|
-
"express": "^5.
|
|
66
|
+
"express": "^5.2.0",
|
|
67
67
|
"koa": "^3.1.1",
|
|
68
68
|
"restify": "^11.1.0"
|
|
69
69
|
},
|
|
@@ -84,16 +84,16 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@hapi/hapi": "21.4.4",
|
|
86
86
|
"@integration/testing-tools": "3.0.0",
|
|
87
|
-
"@serenity-js/assertions": "3.
|
|
88
|
-
"@serenity-js/rest": "3.
|
|
87
|
+
"@serenity-js/assertions": "3.37.0",
|
|
88
|
+
"@serenity-js/rest": "3.37.0",
|
|
89
89
|
"@types/chai": "4.3.20",
|
|
90
|
-
"@types/express": "5.0.
|
|
90
|
+
"@types/express": "5.0.6",
|
|
91
91
|
"@types/hapi": "18.0.15",
|
|
92
92
|
"@types/mocha": "10.0.10",
|
|
93
93
|
"@types/restify": "8.5.12",
|
|
94
94
|
"axios": "1.13.2",
|
|
95
95
|
"c8": "10.1.3",
|
|
96
|
-
"express": "5.
|
|
96
|
+
"express": "5.2.0",
|
|
97
97
|
"koa": "3.1.1",
|
|
98
98
|
"mocha": "11.7.5",
|
|
99
99
|
"mocha-multi": "1.1.7",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"ts-node": "10.9.2",
|
|
103
103
|
"typescript": "5.9.3"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "dae146cd99a04f09b5926fb9d3205af562fa2927"
|
|
106
106
|
}
|