@typespec/spector 0.1.0-alpha.2 → 0.1.0-alpha.20-dev.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 +118 -0
- package/README.md +37 -0
- package/dist/generated-defs/TypeSpec.Spector.ts-test.js +5 -2
- package/dist/generated-defs/TypeSpec.Spector.ts-test.js.map +1 -1
- package/dist/src/actions/helper.d.ts +8 -15
- package/dist/src/actions/helper.d.ts.map +1 -1
- package/dist/src/actions/helper.js +61 -69
- package/dist/src/actions/helper.js.map +1 -1
- package/dist/src/actions/serve.d.ts.map +1 -1
- package/dist/src/actions/serve.js +3 -4
- package/dist/src/actions/serve.js.map +1 -1
- package/dist/src/actions/server-test.d.ts +3 -5
- package/dist/src/actions/server-test.d.ts.map +1 -1
- package/dist/src/actions/server-test.js +108 -132
- package/dist/src/actions/server-test.js.map +1 -1
- package/dist/src/actions/upload-coverage-report.d.ts +2 -1
- package/dist/src/actions/upload-coverage-report.d.ts.map +1 -1
- package/dist/src/actions/upload-coverage-report.js +6 -2
- package/dist/src/actions/upload-coverage-report.js.map +1 -1
- package/dist/src/actions/upload-scenario-manifest.d.ts +3 -2
- package/dist/src/actions/upload-scenario-manifest.d.ts.map +1 -1
- package/dist/src/actions/upload-scenario-manifest.js +8 -5
- package/dist/src/actions/upload-scenario-manifest.js.map +1 -1
- package/dist/src/actions/validate-mock-apis.js +1 -1
- package/dist/src/actions/validate-mock-apis.js.map +1 -1
- package/dist/src/app/app.d.ts +1 -0
- package/dist/src/app/app.d.ts.map +1 -1
- package/dist/src/app/app.js +48 -54
- package/dist/src/app/app.js.map +1 -1
- package/dist/src/app/request-processor.d.ts +2 -2
- package/dist/src/app/request-processor.d.ts.map +1 -1
- package/dist/src/app/request-processor.js +10 -6
- package/dist/src/app/request-processor.js.map +1 -1
- package/dist/src/cli/cli.js +24 -15
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/coverage/common.d.ts.map +1 -1
- package/dist/src/coverage/common.js +1 -0
- package/dist/src/coverage/common.js.map +1 -1
- package/dist/src/coverage/coverage-tracker.d.ts.map +1 -1
- package/dist/src/coverage/coverage-tracker.js.map +1 -1
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +0 -2
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/logger.d.ts +16 -2
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +27 -8
- package/dist/src/logger.js.map +1 -1
- package/dist/src/server/server.d.ts +1 -1
- package/dist/src/server/server.d.ts.map +1 -1
- package/dist/src/server/server.js +18 -5
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/utils/body-utils.d.ts.map +1 -1
- package/dist/src/utils/request-utils.d.ts.map +1 -1
- package/docs/decorators.md +24 -0
- package/docs/using-spector.md +99 -0
- package/docs/writing-mock-apis.md +116 -0
- package/docs/writing-scenario-spec.md +49 -0
- package/generated-defs/TypeSpec.Spector.ts-test.ts +7 -2
- package/lib/main.tsp +1 -1
- package/package.json +24 -28
- package/src/actions/helper.ts +79 -95
- package/src/actions/serve.ts +3 -4
- package/src/actions/server-test.ts +132 -156
- package/src/actions/upload-coverage-report.ts +7 -1
- package/src/actions/upload-scenario-manifest.ts +11 -7
- package/src/actions/validate-mock-apis.ts +1 -1
- package/src/app/app.ts +71 -72
- package/src/app/request-processor.ts +16 -4
- package/src/cli/cli.ts +24 -15
- package/src/coverage/common.ts +1 -0
- package/src/coverage/coverage-tracker.ts +2 -2
- package/src/lib/decorators.ts +0 -2
- package/src/logger.ts +39 -8
- package/src/scenarios-resolver.ts +1 -1
- package/src/server/server.ts +21 -7
- package/temp/.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,123 @@
|
|
|
1
1
|
# Change Log - @typespec/spector
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.19
|
|
4
|
+
|
|
5
|
+
### Bump dependencies
|
|
6
|
+
|
|
7
|
+
- [#8437](https://github.com/microsoft/typespec/pull/8437) Upgrade dependencies
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 0.1.0-alpha.18
|
|
11
|
+
|
|
12
|
+
### Bump dependencies
|
|
13
|
+
|
|
14
|
+
- [#8317](https://github.com/microsoft/typespec/pull/8317) Upgrade dependencies
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 0.1.0-alpha.17
|
|
18
|
+
|
|
19
|
+
### Bump dependencies
|
|
20
|
+
|
|
21
|
+
- [#7978](https://github.com/microsoft/typespec/pull/7978) Upgrade dependencies
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 0.1.0-alpha.16
|
|
25
|
+
|
|
26
|
+
### Bump dependencies
|
|
27
|
+
|
|
28
|
+
- [#7674](https://github.com/microsoft/typespec/pull/7674) Upgrade dependencies
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## 0.1.0-alpha.15
|
|
32
|
+
|
|
33
|
+
### Bump dependencies
|
|
34
|
+
|
|
35
|
+
- [#7477](https://github.com/microsoft/typespec/pull/7477) Update multer dependency
|
|
36
|
+
- [#7323](https://github.com/microsoft/typespec/pull/7323) Upgrade dependencies
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## 0.1.0-alpha.14
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
- [#7270](https://github.com/microsoft/typespec/pull/7270) Fix specs using `dyn` when using port `0`
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 0.1.0-alpha.13
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
- [#7066](https://github.com/microsoft/typespec/pull/7066) Add dynamic value resolution in spector mock apis with a new `dyn` string template builder
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## 0.1.0-alpha.12
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- [#6926](https://github.com/microsoft/typespec/pull/6926) Upgrade to express v5
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## 0.1.0-alpha.10
|
|
61
|
+
|
|
62
|
+
No changes, version bump only.
|
|
63
|
+
|
|
64
|
+
## 0.1.0-alpha.10
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
- [#6565](https://github.com/microsoft/typespec/pull/6565) Make handling of request body and response body consistent
|
|
69
|
+
- [#6543](https://github.com/microsoft/typespec/pull/6543) Rename `server-test` command to `knock`
|
|
70
|
+
|
|
71
|
+
### Bump dependencies
|
|
72
|
+
|
|
73
|
+
- [#6595](https://github.com/microsoft/typespec/pull/6595) Upgrade dependencies
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
- [#6527](https://github.com/microsoft/typespec/pull/6527) Don't throw for scenarios that expect error response
|
|
78
|
+
- [#6562](https://github.com/microsoft/typespec/pull/6562) Updates `tsp-spector knock` to exit with a failure if no scenarios are executed
|
|
79
|
+
- [#6543](https://github.com/microsoft/typespec/pull/6543) Add new `--filter` option to `knock` command
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 0.1.0-alpha.9
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
- [#6327](https://github.com/microsoft/typespec/pull/6327) Remove reference to delete projection feature
|
|
87
|
+
- [#6201](https://github.com/microsoft/typespec/pull/6201) Support `application/jsonl` as binary.
|
|
88
|
+
|
|
89
|
+
### Bump dependencies
|
|
90
|
+
|
|
91
|
+
- [#6266](https://github.com/microsoft/typespec/pull/6266) Update dependencies
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 0.1.0-alpha.8
|
|
95
|
+
|
|
96
|
+
No changes, version bump only.
|
|
97
|
+
|
|
98
|
+
## 0.1.0-alpha.7
|
|
99
|
+
|
|
100
|
+
### Bump dependencies
|
|
101
|
+
|
|
102
|
+
- [#5690](https://github.com/microsoft/typespec/pull/5690) Upgrade dependencies
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## 0.1.0-alpha.6
|
|
106
|
+
|
|
107
|
+
No changes, version bump only.
|
|
108
|
+
|
|
109
|
+
## 0.1.0-alpha.5
|
|
110
|
+
|
|
111
|
+
No changes, version bump only.
|
|
112
|
+
|
|
113
|
+
## 0.1.0-alpha.4
|
|
114
|
+
|
|
115
|
+
- Update `server start` script parameter - `scenarioPath` to `scenarioPaths`.
|
|
116
|
+
|
|
117
|
+
## 0.1.0-alpha.3
|
|
118
|
+
|
|
119
|
+
No changes, version bump only.
|
|
120
|
+
|
|
3
121
|
## 0.1.0-alpha.2
|
|
4
122
|
|
|
5
123
|
- Fix the handling of multiple scenario paths in `manifest.json` file.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Spector
|
|
2
|
+
|
|
3
|
+
Spector is a tool and typespec library used to describe spec for various protocols and running mock server and mock client based on these specs and some mock apis data.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### `serve`
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
tsp serve ./path/to/specs/
|
|
11
|
+
tsp serve ./path/to/specs/ --port 3000
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### `server start` and `server stop`
|
|
15
|
+
|
|
16
|
+
Start the server and stop the server in a separate process.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
tsp server start ./path/to/specs/
|
|
20
|
+
... run tests ...
|
|
21
|
+
tsp server stop
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### `knock`
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
tsp knock ./path/to/specs/
|
|
28
|
+
tsp knock ./path/to/specs/ --baseUrl http://localhost:3000
|
|
29
|
+
tsp knock ./path/to/specs/ --filter "payload/multipart/**/*"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Options:
|
|
33
|
+
|
|
34
|
+
| Option | Description | Default |
|
|
35
|
+
| ----------- | ---------------------------------------- | ----------------------- |
|
|
36
|
+
| `--baseUrl` | Base url for the server | `http://localhost:3000` |
|
|
37
|
+
| `--filter` | Filters for which scenarios to run(glob) | |
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// An error in the imports would mean that the decorator is not exported or
|
|
2
|
+
// doesn't have the right name.
|
|
2
3
|
import { $decorators } from "@typespec/spector";
|
|
3
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ...
|
|
6
|
+
*/
|
|
4
7
|
const _ = $decorators["TypeSpec.Spector"];
|
|
5
8
|
//# sourceMappingURL=TypeSpec.Spector.ts-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSpec.Spector.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts-test.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TypeSpec.Spector.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts-test.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+BAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,GAA8B,WAAW,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { HttpMethod,
|
|
2
|
-
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
1
|
+
import { HttpMethod, MockBody, MockMultipartBody, ResolverConfig } from "@typespec/spec-api";
|
|
3
2
|
export interface ServiceRequest {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
method: HttpMethod;
|
|
4
|
+
url: string;
|
|
5
|
+
body?: MockBody | MockMultipartBody;
|
|
6
|
+
headers?: Record<string, unknown>;
|
|
7
|
+
query?: Record<string, unknown>;
|
|
8
|
+
pathParams?: Record<string, unknown>;
|
|
10
9
|
}
|
|
11
|
-
export declare function makeServiceCall(
|
|
12
|
-
export declare function makePutCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
13
|
-
export declare function makePostCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
14
|
-
export declare function makeGetCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
15
|
-
export declare function makePatchCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
16
|
-
export declare function makeDeleteCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
17
|
-
export declare function makeHeadCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
|
|
10
|
+
export declare function makeServiceCall(request: ServiceRequest, config: ResolverConfig): Promise<Response>;
|
|
18
11
|
type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
|
19
12
|
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
|
20
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAiDD,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED,KAAK,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;AAC7D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAElF"}
|
|
@@ -1,79 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
for (const key in request.options.requestBody) {
|
|
8
|
-
formData.append(key, JSON.stringify(request.options.requestBody[key]));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
if (request.options.files) {
|
|
12
|
-
request.options.files.forEach((file) => {
|
|
13
|
-
formData.append(`${file.fieldname}`, file.buffer, {
|
|
14
|
-
filename: file.originalname,
|
|
15
|
-
contentType: file.mimetype,
|
|
16
|
-
});
|
|
17
|
-
});
|
|
1
|
+
import { expandDyns, } from "@typespec/spec-api";
|
|
2
|
+
function renderMultipartRequest(body) {
|
|
3
|
+
const formData = new FormData();
|
|
4
|
+
if (body.parts) {
|
|
5
|
+
for (const key in body.parts) {
|
|
6
|
+
formData.append(key, JSON.stringify(body.parts[key]));
|
|
18
7
|
}
|
|
19
|
-
request.options.requestBody = formData;
|
|
20
|
-
request.options.config = {
|
|
21
|
-
...request.options.config,
|
|
22
|
-
headers: formData.getHeaders(),
|
|
23
|
-
};
|
|
24
8
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
request.endPoint = request.endPoint.replace(`:${key}`, request.options.config.params[key]);
|
|
30
|
-
}
|
|
9
|
+
if (body.files) {
|
|
10
|
+
body.files.forEach((file) => {
|
|
11
|
+
formData.append(`${file.fieldname}`, new Blob([file.buffer], { type: file.mimetype }), file.originalname);
|
|
12
|
+
});
|
|
31
13
|
}
|
|
32
|
-
|
|
14
|
+
return formData;
|
|
33
15
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (serviceCallType === "post") {
|
|
41
|
-
return await makePostCall(request);
|
|
42
|
-
}
|
|
43
|
-
if (serviceCallType === "get") {
|
|
44
|
-
return await makeGetCall(request);
|
|
45
|
-
}
|
|
46
|
-
if (serviceCallType === "delete") {
|
|
47
|
-
return await makeDeleteCall(request);
|
|
16
|
+
function resolveUrl(request) {
|
|
17
|
+
let endpoint = request.url;
|
|
18
|
+
if (request.pathParams) {
|
|
19
|
+
for (const [key, value] of Object.entries(request.pathParams)) {
|
|
20
|
+
endpoint = endpoint.replaceAll(`:${key}`, String(value));
|
|
21
|
+
}
|
|
48
22
|
}
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
endpoint = endpoint.replaceAll("\\:", ":");
|
|
24
|
+
if (request.query) {
|
|
25
|
+
const query = new URLSearchParams();
|
|
26
|
+
for (const [key, value] of Object.entries(request.query)) {
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
for (const v of value) {
|
|
29
|
+
query.append(key, v);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
query.append(key, value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
endpoint = `${endpoint}?${query.toString()}`;
|
|
51
37
|
}
|
|
52
|
-
return
|
|
38
|
+
return endpoint;
|
|
53
39
|
}
|
|
54
|
-
export async function
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
40
|
+
export async function makeServiceCall(request, config) {
|
|
41
|
+
const url = resolveUrl(request);
|
|
42
|
+
let body;
|
|
43
|
+
let headers = expandDyns(request.headers, config);
|
|
44
|
+
if (request.body) {
|
|
45
|
+
if ("kind" in request.body) {
|
|
46
|
+
const formData = renderMultipartRequest(request.body);
|
|
47
|
+
body = formData;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (typeof request.body.rawContent === "string" || Buffer.isBuffer(request.body.rawContent)) {
|
|
51
|
+
body = request.body.rawContent;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
body = request.body.rawContent?.serialize(config);
|
|
55
|
+
}
|
|
56
|
+
headers = {
|
|
57
|
+
...headers,
|
|
58
|
+
...(request.body?.contentType && {
|
|
59
|
+
"Content-Type": request.body.contentType,
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return await fetch(url, {
|
|
65
|
+
method: request.method.toUpperCase(),
|
|
66
|
+
body,
|
|
67
|
+
headers,
|
|
68
|
+
});
|
|
77
69
|
}
|
|
78
70
|
export function uint8ArrayToString(bytes, format) {
|
|
79
71
|
return Buffer.from(bytes).toString(format);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAKX,MAAM,oBAAoB,CAAC;AAW5B,SAAS,sBAAsB,CAAC,IAAuB;IACrD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7B,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CA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D,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE;QACpC,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,KAAK,CAAC,MAAM,EAAE,WAAW,iBAgB9C;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,iBAmC1D;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,iBAc5C"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { spawn } from "child_process";
|
|
2
|
-
import fetch from "node-fetch";
|
|
3
2
|
import { resolve } from "path";
|
|
4
3
|
import { MockApiApp } from "../app/app.js";
|
|
5
4
|
import { AdminUrls } from "../constants.js";
|
|
@@ -27,12 +26,12 @@ export async function startInBackground(config) {
|
|
|
27
26
|
const [nodeExe, entrypoint] = process.argv;
|
|
28
27
|
logger.info(`Starting server in background at port ${config.port}`);
|
|
29
28
|
const scenariosPath = Array.isArray(config.scenariosPath)
|
|
30
|
-
? config.scenariosPath
|
|
31
|
-
: config.scenariosPath;
|
|
29
|
+
? config.scenariosPath
|
|
30
|
+
: [config.scenariosPath];
|
|
32
31
|
const cp = spawn(nodeExe, [
|
|
33
32
|
entrypoint,
|
|
34
33
|
"serve",
|
|
35
|
-
scenariosPath,
|
|
34
|
+
...scenariosPath,
|
|
36
35
|
"--port",
|
|
37
36
|
config.port.toString(),
|
|
38
37
|
"--coverageFile",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAY9D,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAmB;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACxC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;YAC3D,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9E,MAAM,yBAAyB,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,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,GAAG,EAAE;YACd,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;YACjD,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAAkB;IAC3C,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,oBAAoB,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE;YAC9D,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export interface ServerTestDiagnostics {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
message: any;
|
|
2
|
+
scenarioName: string;
|
|
3
|
+
message: string;
|
|
5
4
|
}
|
|
6
5
|
export interface ServerTestOptions {
|
|
7
6
|
baseUrl?: string;
|
|
8
|
-
|
|
9
|
-
runScenariosFromFile?: string;
|
|
7
|
+
filter?: string;
|
|
10
8
|
}
|
|
11
9
|
export declare function serverTest(scenariosPath: string, options?: ServerTestOptions): Promise<void>;
|
|
12
10
|
//# sourceMappingURL=server-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-test.d.ts","sourceRoot":"","sources":["../../../src/actions/server-test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-test.d.ts","sourceRoot":"","sources":["../../../src/actions/server-test.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAwFD,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuBD,wBAAsB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,iBA2EtF"}
|