@serenity-js/local-server 3.24.1 → 3.25.1
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 +1 -1
- package/lib/screenplay/abilities/ManageALocalServer.d.ts +7 -6
- package/lib/screenplay/abilities/ManageALocalServer.d.ts.map +1 -1
- package/lib/screenplay/abilities/ManageALocalServer.js +6 -5
- package/lib/screenplay/abilities/ManageALocalServer.js.map +1 -1
- package/lib/screenplay/interactions/StartLocalServer.d.ts +2 -2
- package/lib/screenplay/interactions/StartLocalServer.js +2 -2
- package/lib/screenplay/questions/LocalServer.d.ts +2 -2
- package/lib/screenplay/questions/LocalServer.js +2 -2
- package/package.json +6 -6
- package/src/screenplay/abilities/ManageALocalServer.ts +7 -6
- package/src/screenplay/interactions/StartLocalServer.ts +2 -2
- package/src/screenplay/questions/LocalServer.ts +2 -2
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.25.1](https://github.com/serenity-js/serenity-js/compare/v3.25.0...v3.25.1) (2024-07-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **core:** all the API docs now link to the online Serenity/JS API documentation ([f8f451d](https://github.com/serenity-js/serenity-js/commit/f8f451dffdb4caaa2e31a860f59d59470f4856ad))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.25.0](https://github.com/serenity-js/serenity-js/compare/v3.24.1...v3.25.0) (2024-07-03)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @serenity-js/local-server
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.24.1](https://github.com/serenity-js/serenity-js/compare/v3.24.0...v3.24.1) (2024-06-26)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @serenity-js/local-server
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ of complex software systems faster, more collaborative and easier to scale.
|
|
|
17
17
|
👋 Join the Serenity/JS Community!
|
|
18
18
|
- Meet other Serenity/JS developers and maintainers on the [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im),
|
|
19
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/contributing),
|
|
20
|
+
- Learn how to [contribute to Serenity/JS](https://serenity-js.org/community/contributing/),
|
|
21
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)!
|
|
22
22
|
|
|
23
23
|
## Serenity/JS Local Server
|
|
@@ -6,7 +6,7 @@ import * as http from 'http';
|
|
|
6
6
|
import * as https from 'https';
|
|
7
7
|
import type * as net from 'net';
|
|
8
8
|
/**
|
|
9
|
-
* An
|
|
9
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) that enables an [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
10
10
|
* to manage a local [Node.js](https://nodejs.org/) server.
|
|
11
11
|
*
|
|
12
12
|
* ## Managing a raw Node.js server
|
|
@@ -49,13 +49,13 @@ export declare class ManageALocalServer extends Ability {
|
|
|
49
49
|
private readonly protocol;
|
|
50
50
|
private readonly server;
|
|
51
51
|
/**
|
|
52
|
-
* An
|
|
52
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTP server using the provided `requestListener`.
|
|
53
53
|
*
|
|
54
54
|
* @param listener
|
|
55
55
|
*/
|
|
56
56
|
static runningAHttpListener(listener: RequestListener | net.Server): ManageALocalServer;
|
|
57
57
|
/**
|
|
58
|
-
* An
|
|
58
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTPS server using the provided server `requestListener`.
|
|
59
59
|
*
|
|
60
60
|
* @param listener
|
|
61
61
|
* @param options
|
|
@@ -98,7 +98,7 @@ export declare class ManageALocalServer extends Ability {
|
|
|
98
98
|
*/
|
|
99
99
|
export type RequestListener = (request: http.IncomingMessage, response: http.ServerResponse) => void;
|
|
100
100
|
/**
|
|
101
|
-
* A
|
|
101
|
+
* A [`net.Server`](https://nodejs.org/api/net.html#class-netserver) with an added shutdown method.
|
|
102
102
|
*
|
|
103
103
|
* @see https://www.npmjs.com/package/http-shutdown
|
|
104
104
|
*/
|
|
@@ -107,8 +107,9 @@ export type ServerWithShutdown = net.Server & {
|
|
|
107
107
|
forceShutdown: (callback: (error?: Error) => void) => void;
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
|
-
* The protocol supported by the instance of the
|
|
111
|
-
* wrapped by the
|
|
110
|
+
* The protocol supported by the instance of the [`ServerWithShutdown`](https://serenity-js.org/api/local-server/#ServerWithShutdown),
|
|
111
|
+
* wrapped by the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
112
|
+
* to [`ManageALocalServer`](https://serenity-js.org/api/local-server/class/ManageALocalServer/).
|
|
112
113
|
*
|
|
113
114
|
* @group Models
|
|
114
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageALocalServer.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/ManageALocalServer.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,OAAO,EAAsB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;A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,EAAE,KAAK,KAAK,IAAI,KAAK,IAAI,CAAC;IACtD,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,kBAAkB;IAC1B,IAAI,SAAS;IACb,KAAK,UAAU;CAClB"}
|
|
@@ -30,7 +30,7 @@ const withShutdownSupport = require("http-shutdown");
|
|
|
30
30
|
const https = __importStar(require("https"));
|
|
31
31
|
const portfinder_1 = require("portfinder");
|
|
32
32
|
/**
|
|
33
|
-
* An
|
|
33
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) that enables an [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
34
34
|
* to manage a local [Node.js](https://nodejs.org/) server.
|
|
35
35
|
*
|
|
36
36
|
* ## Managing a raw Node.js server
|
|
@@ -73,7 +73,7 @@ class ManageALocalServer extends core_1.Ability {
|
|
|
73
73
|
protocol;
|
|
74
74
|
server;
|
|
75
75
|
/**
|
|
76
|
-
* An
|
|
76
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTP server using the provided `requestListener`.
|
|
77
77
|
*
|
|
78
78
|
* @param listener
|
|
79
79
|
*/
|
|
@@ -84,7 +84,7 @@ class ManageALocalServer extends core_1.Ability {
|
|
|
84
84
|
return new ManageALocalServer(SupportedProtocols.HTTP, server);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* An
|
|
87
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTPS server using the provided server `requestListener`.
|
|
88
88
|
*
|
|
89
89
|
* @param listener
|
|
90
90
|
* @param options
|
|
@@ -148,8 +148,9 @@ class ManageALocalServer extends core_1.Ability {
|
|
|
148
148
|
}
|
|
149
149
|
exports.ManageALocalServer = ManageALocalServer;
|
|
150
150
|
/**
|
|
151
|
-
* The protocol supported by the instance of the
|
|
152
|
-
* wrapped by the
|
|
151
|
+
* The protocol supported by the instance of the [`ServerWithShutdown`](https://serenity-js.org/api/local-server/#ServerWithShutdown),
|
|
152
|
+
* wrapped by the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
153
|
+
* to [`ManageALocalServer`](https://serenity-js.org/api/local-server/class/ManageALocalServer/).
|
|
153
154
|
*
|
|
154
155
|
* @group Models
|
|
155
156
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageALocalServer.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/ManageALocalServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAgE;AAChE,2CAA6B;AAC7B,qDAAsD;AACtD,6CAA+B;AAE/B,2CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,kBAAmB,SAAQ,cAAO;IA2Cd;IAzCZ,MAAM,CAAqB;IAE5C;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAsC;QAC9D,MAAM,MAAM,GAAG,OAAO,QAAQ,KAAK,UAAU;YACzC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC7B,CAAC,CAAC,QAAQ,CAAC;QAEf,OAAO,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAwC,EAAE,UAA+B,EAAE;QACpG,MAAM,MAAM,GAAG,OAAO,QAAQ,KAAK,UAAU;YACzC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC;YACvC,CAAC,CAAC,QAAQ,CAAC;QAEf,OAAO,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;OAQG;IACH,YAA6B,QAA4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,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAChD,SAAS,YAAY,CAAC,KAA6B;gBAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;oBAC7B,OAAO,MAAM,CAAC,IAAI,yBAAkB,CAAC,qEAAsE,IAAK,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;iBAChI;gBAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAExC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE;gBACvC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBAElD,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAI,EAAoE;QAC/E,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;CACJ;AAtFD,gDAsFC;AAmBD;;;;;;GAMG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,qCAAe,CAAA;AACnB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B"}
|
|
@@ -11,14 +11,14 @@ export declare class StartLocalServer {
|
|
|
11
11
|
*/
|
|
12
12
|
static onRandomPort(): Interaction;
|
|
13
13
|
/**
|
|
14
|
-
* Instructs the
|
|
14
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a `preferredPort`,
|
|
15
15
|
* or a random one if that's not available.
|
|
16
16
|
*
|
|
17
17
|
* @param preferredPort
|
|
18
18
|
*/
|
|
19
19
|
static onPort(preferredPort: Answerable<number>): Interaction;
|
|
20
20
|
/**
|
|
21
|
-
* Instructs the
|
|
21
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a random port
|
|
22
22
|
* between `lowestPort` and `highestPort`, inclusive.
|
|
23
23
|
*
|
|
24
24
|
* @param {Answerable<number>} lowestPort
|
|
@@ -16,7 +16,7 @@ class StartLocalServer {
|
|
|
16
16
|
return new StartLocalServerOnRandomPort();
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Instructs the
|
|
19
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a `preferredPort`,
|
|
20
20
|
* or a random one if that's not available.
|
|
21
21
|
*
|
|
22
22
|
* @param preferredPort
|
|
@@ -25,7 +25,7 @@ class StartLocalServer {
|
|
|
25
25
|
return new StartLocalServerOnPort(preferredPort);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Instructs the
|
|
28
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a random port
|
|
29
29
|
* between `lowestPort` and `highestPort`, inclusive.
|
|
30
30
|
*
|
|
31
31
|
* @param {Answerable<number>} lowestPort
|
|
@@ -5,12 +5,12 @@ import type { QuestionAdapter } from '@serenity-js/core';
|
|
|
5
5
|
export declare class LocalServer {
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the URL of the local server started
|
|
8
|
-
* using the
|
|
8
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
9
9
|
*/
|
|
10
10
|
static url(): QuestionAdapter<string>;
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves the port number of the local server started
|
|
13
|
-
* using the
|
|
13
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
14
14
|
*/
|
|
15
15
|
static port(): QuestionAdapter<number>;
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ const abilities_1 = require("../abilities");
|
|
|
10
10
|
class LocalServer {
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves the URL of the local server started
|
|
13
|
-
* using the
|
|
13
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
14
14
|
*/
|
|
15
15
|
static url() {
|
|
16
16
|
return core_1.Question.about('the URL of the local server', actor => {
|
|
@@ -34,7 +34,7 @@ class LocalServer {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Retrieves the port number of the local server started
|
|
37
|
-
* using the
|
|
37
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
38
38
|
*/
|
|
39
39
|
static port() {
|
|
40
40
|
return core_1.Question.about(`local server port number`, async (actor) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/local-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.1",
|
|
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",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"node": "^16.13 || ^18.12 || ^20"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@serenity-js/core": "3.
|
|
53
|
+
"@serenity-js/core": "3.25.1",
|
|
54
54
|
"http-shutdown": "1.2.2",
|
|
55
55
|
"portfinder": "1.0.32"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@hapi/hapi": "21.3.10",
|
|
59
59
|
"@integration/testing-tools": "3.0.0",
|
|
60
|
-
"@serenity-js/assertions": "3.
|
|
61
|
-
"@serenity-js/rest": "3.
|
|
60
|
+
"@serenity-js/assertions": "3.25.1",
|
|
61
|
+
"@serenity-js/rest": "3.25.1",
|
|
62
62
|
"@types/chai": "4.3.16",
|
|
63
63
|
"@types/express": "4.17.21",
|
|
64
64
|
"@types/hapi": "18.0.14",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"c8": "10.1.2",
|
|
69
69
|
"express": "4.19.2",
|
|
70
70
|
"koa": "2.15.3",
|
|
71
|
-
"mocha": "10.
|
|
71
|
+
"mocha": "10.6.0",
|
|
72
72
|
"mocha-multi": "1.1.7",
|
|
73
73
|
"restify": "11.1.0",
|
|
74
74
|
"semver": "7.6.2",
|
|
75
75
|
"ts-node": "10.9.2",
|
|
76
76
|
"typescript": "5.2.2"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "450b994115cf9f1a1547ef92ac9387e0c57821ce"
|
|
79
79
|
}
|
|
@@ -6,7 +6,7 @@ import type * as net from 'net';
|
|
|
6
6
|
import { getPortPromise } from 'portfinder';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* An
|
|
9
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) that enables an [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
10
10
|
* to manage a local [Node.js](https://nodejs.org/) server.
|
|
11
11
|
*
|
|
12
12
|
* ## Managing a raw Node.js server
|
|
@@ -50,7 +50,7 @@ export class ManageALocalServer extends Ability {
|
|
|
50
50
|
private readonly server: ServerWithShutdown;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* An
|
|
53
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTP server using the provided `requestListener`.
|
|
54
54
|
*
|
|
55
55
|
* @param listener
|
|
56
56
|
*/
|
|
@@ -63,7 +63,7 @@ export class ManageALocalServer extends Ability {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* An
|
|
66
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) to manage a Node.js HTTPS server using the provided server `requestListener`.
|
|
67
67
|
*
|
|
68
68
|
* @param listener
|
|
69
69
|
* @param options
|
|
@@ -141,7 +141,7 @@ export class ManageALocalServer extends Ability {
|
|
|
141
141
|
export type RequestListener = (request: http.IncomingMessage, response: http.ServerResponse) => void;
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* A
|
|
144
|
+
* A [`net.Server`](https://nodejs.org/api/net.html#class-netserver) with an added shutdown method.
|
|
145
145
|
*
|
|
146
146
|
* @see https://www.npmjs.com/package/http-shutdown
|
|
147
147
|
*/
|
|
@@ -151,8 +151,9 @@ export type ServerWithShutdown = net.Server & {
|
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* The protocol supported by the instance of the
|
|
155
|
-
* wrapped by the
|
|
154
|
+
* The protocol supported by the instance of the [`ServerWithShutdown`](https://serenity-js.org/api/local-server/#ServerWithShutdown),
|
|
155
|
+
* wrapped by the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
156
|
+
* to [`ManageALocalServer`](https://serenity-js.org/api/local-server/class/ManageALocalServer/).
|
|
156
157
|
*
|
|
157
158
|
* @group Models
|
|
158
159
|
*/
|
|
@@ -18,7 +18,7 @@ export class StartLocalServer {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Instructs the
|
|
21
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a `preferredPort`,
|
|
22
22
|
* or a random one if that's not available.
|
|
23
23
|
*
|
|
24
24
|
* @param preferredPort
|
|
@@ -28,7 +28,7 @@ export class StartLocalServer {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Instructs the
|
|
31
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to start a local test server on a random port
|
|
32
32
|
* between `lowestPort` and `highestPort`, inclusive.
|
|
33
33
|
*
|
|
34
34
|
* @param {Answerable<number>} lowestPort
|
|
@@ -12,7 +12,7 @@ export class LocalServer {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves the URL of the local server started
|
|
15
|
-
* using the
|
|
15
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
16
16
|
*/
|
|
17
17
|
static url(): QuestionAdapter<string> {
|
|
18
18
|
return Question.about<string>('the URL of the local server', actor => {
|
|
@@ -40,7 +40,7 @@ export class LocalServer {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Retrieves the port number of the local server started
|
|
43
|
-
* using the
|
|
43
|
+
* using the [`StartLocalServer`](https://serenity-js.org/api/local-server/class/StartLocalServer/) [interaction](https://serenity-js.org/api/core/class/Interaction/).
|
|
44
44
|
*/
|
|
45
45
|
static port(): QuestionAdapter<number> {
|
|
46
46
|
return Question.about(`local server port number`, async actor => {
|