@serenity-js/local-server 3.10.1 → 3.10.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +31 -27
  3. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.10.2](https://github.com/serenity-js/serenity-js/compare/v3.10.1...v3.10.2) (2023-09-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **core:** updated installation instruction in the README ([ec3f277](https://github.com/serenity-js/serenity-js/commit/ec3f2778334abbd7324497ceaa2df9f0560a103e)), closes [#1915](https://github.com/serenity-js/serenity-js/issues/1915)
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.10.1](https://github.com/serenity-js/serenity-js/compare/v3.10.0...v3.10.1) (2023-09-01)
7
18
 
8
19
  **Note:** Version bump only for package @serenity-js/local-server
package/README.md CHANGED
@@ -9,9 +9,10 @@
9
9
  of complex software systems faster, more collaborative and easier to scale.
10
10
 
11
11
  ⭐️ Get started with Serenity/JS!
12
- - [Serenity/JS Handbook](https://serenity-js.org/handbook) and [tutorial](https://serenity-js.org/handbook/web-testing/your-first-web-scenario),
13
- - [API documentation](https://serenity-js.org/api/core),
14
- - [Serenity/JS project templates on GitHub](https://serenity-js.org/handbook/getting-started#serenityjs-project-templates).
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) and [Getting Started guides](https://serenity-js.org/handbook/getting-started/)
14
+ - [API documentation](https://serenity-js.org/api/core)
15
+ - [Serenity/JS Project Templates on GitHub](https://serenity-js.org/handbook/getting-started#serenityjs-project-templates)
15
16
 
16
17
  👋 Join the Serenity/JS Community!
17
18
  - Meet other Serenity/JS developers and maintainers on the [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im),
@@ -30,27 +31,30 @@ or raw [Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transactio
30
31
  ### Installation
31
32
 
32
33
  To install this module, run the following command in your computer terminal:
33
- ```console
34
- npm install --save-dev @serenity-js/{core,local-server}
34
+
35
+ ```sh
36
+ npm install --save-dev @serenity-js/core @serenity-js/local-server
35
37
  ```
36
38
 
39
+ To learn more about Serenity/JS and how to use it on your project, follow the [Serenity/JS Getting Started guide](https://serenity-js.org/handbook/getting-started/).
40
+
37
41
  ### Example test
38
42
 
39
43
  ```typescript
40
- import { actorCalled } from '@serenity-js/core';
44
+ import { actorCalled } from '@serenity-js/core'
41
45
  import {
42
46
  ManageALocalServer, StartLocalTestServer, StopLocalTestServer
43
47
  } from '@serenity-js/local-server'
44
- import { CallAnApi, GetRequest, Send } from '@serenity-js/rest';
45
- import { Ensure, equals } from '@serenity-js/assertions';
46
- import axios from 'axios';
48
+ import { CallAnApi, GetRequest, Send } from '@serenity-js/rest'
49
+ import { Ensure, equals } from '@serenity-js/assertions'
50
+ import axios from 'axios'
47
51
 
48
- import { requestListener } from './listener'; (1)
52
+ import { requestListener } from './listener' (1)
49
53
 
50
54
  const actor = actorCalled('Apisit').whoCan(
51
55
  ManageALocalServer.using(requestListener), (2)
52
56
  CallAnApi.using(axios.create()),
53
- );
57
+ )
54
58
 
55
59
  await actor.attemptsTo(
56
60
  StartLocalTestServer.onRandomPort(), (3)
@@ -58,7 +62,7 @@ await actor.attemptsTo(
58
62
  Ensure.that(LastResponse.status(), equals(200)),
59
63
  Ensure.that(LastResponse.body(), equals('Hello!')),
60
64
  StopLocalTestServer.ifRunning(), (5)
61
- );
65
+ )
62
66
  ```
63
67
 
64
68
  In the above example:
@@ -84,8 +88,8 @@ satisfy the above test.
84
88
  ```javascript
85
89
  // listener.js
86
90
  module.exports.requestListener = (request, response) => {
87
- response.setHeader('Connection', 'close');
88
- response.end('Hello World!');
91
+ response.setHeader('Connection', 'close')
92
+ response.end('Hello World!')
89
93
  }
90
94
  ```
91
95
 
@@ -95,12 +99,12 @@ module.exports.requestListener = (request, response) => {
95
99
 
96
100
  ```javascript
97
101
  // listener.js
98
- const express = require('express');
102
+ const express = require('express')
99
103
 
100
104
  module.exports.requestListener = express().
101
105
  get('/', (req: express.Request, res: express.Response) => {
102
- res.status(200).send('Hello World!');
103
- });
106
+ res.status(200).send('Hello World!')
107
+ })
104
108
  ```
105
109
 
106
110
  [Learn more about Express](https://expressjs.com/).
@@ -109,12 +113,12 @@ module.exports.requestListener = express().
109
113
 
110
114
  ```javascript
111
115
  // listener.js
112
- const hapi = require('@hapi/hapi');
116
+ const hapi = require('@hapi/hapi')
113
117
 
114
- const server = new hapi.Server();
118
+ const server = new hapi.Server()
115
119
  server.route({ method: 'GET', path: '/', handler: (req, h) => 'Hello World!' })
116
120
 
117
- module.exports.requestListener = server.listener;
121
+ module.exports.requestListener = server.listener
118
122
  ```
119
123
 
120
124
  [Learn more about HAPI](https://hapijs.com/).
@@ -123,11 +127,11 @@ module.exports.requestListener = server.listener;
123
127
 
124
128
  ```javascript
125
129
  // listener.js
126
- const Koa = require('koa');
130
+ const Koa = require('koa')
127
131
 
128
132
  module.exports.requestListener = new Koa()
129
133
  .use(ctx => Promise.resolve(ctx.body = 'Hello World!'))
130
- .callback();
134
+ .callback()
131
135
  ```
132
136
 
133
137
  [Learn more about Koa](https://koajs.com/).
@@ -136,15 +140,15 @@ module.exports.requestListener = new Koa()
136
140
 
137
141
  ```javascript
138
142
  // listener.js
139
- const restify = require('restify');
143
+ const restify = require('restify')
140
144
 
141
- const server = restify.createServer(options);
145
+ const server = restify.createServer(options)
142
146
 
143
147
  server.get('/', (req, res, next) => {
144
- res.send('Hello World!');
145
- });
148
+ res.send('Hello World!')
149
+ })
146
150
 
147
- module.exports.requestListener = server;
151
+ module.exports.requestListener = server
148
152
  ```
149
153
 
150
154
  [Learn more about Restify](http://restify.com/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenity-js/local-server",
3
- "version": "3.10.1",
3
+ "version": "3.10.2",
4
4
  "description": "Enables Serenity/JS Actors to manage local Node.js test servers, such as Express, Koa or Restify",
5
5
  "author": {
6
6
  "name": "Jan Molak",
@@ -49,18 +49,18 @@
49
49
  "node": "^16.13 || ^18.12 || ^20"
50
50
  },
51
51
  "dependencies": {
52
- "@serenity-js/core": "3.10.1",
52
+ "@serenity-js/core": "3.10.2",
53
53
  "http-shutdown": "^1.2.2",
54
54
  "portfinder": "^1.0.32"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@hapi/hapi": "^21.3.2",
58
58
  "@integration/testing-tools": "3.0.0",
59
- "@serenity-js/assertions": "3.10.1",
60
- "@serenity-js/rest": "3.10.1",
61
- "@types/chai": "^4.3.5",
59
+ "@serenity-js/assertions": "3.10.2",
60
+ "@serenity-js/rest": "3.10.2",
61
+ "@types/chai": "^4.3.6",
62
62
  "@types/express": "^4.17.17",
63
- "@types/hapi": "^18.0.9",
63
+ "@types/hapi": "^18.0.10",
64
64
  "@types/mocha": "^10.0.1",
65
65
  "@types/restify": "^8.5.7",
66
66
  "axios": "^1.5.0",
@@ -74,5 +74,5 @@
74
74
  "ts-node": "^10.9.1",
75
75
  "typescript": "5.1.6"
76
76
  },
77
- "gitHead": "7ab90f30b17ed745cad713363a27edfd7cdce08a"
77
+ "gitHead": "6834827fffe5dd8dd3d2f39d2fea2c4039ab1d3d"
78
78
  }