@nestia/e2e 0.3.4 → 0.3.5
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 +9 -4
- package/package.json +2 -2
- package/src/TestValidator.ts +19 -0
package/README.md
CHANGED
|
@@ -14,14 +14,18 @@ Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
|
14
14
|
- SDK generator for clients
|
|
15
15
|
- Swagger generator evolved than ever
|
|
16
16
|
- Automatic E2E test functions generator
|
|
17
|
+
- Mockup Simulator for client applications
|
|
17
18
|
- `nestia`: just CLI (command line interface) tool
|
|
18
19
|
|
|
19
20
|
> **Note**
|
|
20
21
|
>
|
|
21
22
|
> - **Only one line** required, with pure TypeScript type
|
|
22
|
-
> -
|
|
23
|
-
>
|
|
24
|
-
>
|
|
23
|
+
> - Enhance performance **30x** up
|
|
24
|
+
> - Runtime validator is **20,000x faster** than `class-validator`
|
|
25
|
+
> - JSON serialization is **200x faster** than `class-transformer`
|
|
26
|
+
> - Software Development Kit
|
|
27
|
+
> - SDK is similar with [tRPC](https://trpc.io), but much advanced
|
|
28
|
+
> - Mockup simulator like [msw](https://mswjs.io/), but fully automated
|
|
25
29
|
|
|
26
30
|

|
|
27
31
|
|
|
@@ -46,9 +50,9 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
46
50
|
### 🏠 Home
|
|
47
51
|
- [Introduction](https://nestia.io/docs/)
|
|
48
52
|
- [Setup](https://nestia.io/docs/setup/)
|
|
53
|
+
- [Pure TypeScript](https://nestia.io/docs/pure)
|
|
49
54
|
|
|
50
55
|
### 📖 Features
|
|
51
|
-
- [Pure TypeScript](https://nestia.io/docs/pure)
|
|
52
56
|
- Core Library
|
|
53
57
|
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
|
|
54
58
|
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
|
|
@@ -58,3 +62,4 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
58
62
|
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
|
|
59
63
|
- [SDK Library](https://nestia.io/docs/sdk/sdk/)
|
|
60
64
|
- [E2E Functions](https://nestia.io/docs/sdk/e2e/)
|
|
65
|
+
- [Mockup Simulator](https://nestia.io/docs/sdk/simulator/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/e2e",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "E2E test utilify functions",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"ts-node": "^10.9.1",
|
|
41
41
|
"ts-patch": "^3.0.0",
|
|
42
42
|
"typescript": "^5.1.3",
|
|
43
|
-
"typia": "^4.
|
|
43
|
+
"typia": "^4.1.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"chalk": "^4.1.2",
|
package/src/TestValidator.ts
CHANGED
|
@@ -142,6 +142,25 @@ export namespace TestValidator {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
export function proceed(task: () => Promise<any>): Promise<Error | null>;
|
|
146
|
+
export function proceed(task: () => any): Error | null;
|
|
147
|
+
export function proceed(
|
|
148
|
+
task: () => any,
|
|
149
|
+
): Promise<Error | null> | (Error | null) {
|
|
150
|
+
try {
|
|
151
|
+
const output: any = task();
|
|
152
|
+
if (is_promise(output))
|
|
153
|
+
return new Promise<Error | null>((resolve) =>
|
|
154
|
+
output
|
|
155
|
+
.catch((exp) => resolve(exp as Error))
|
|
156
|
+
.then(() => resolve(null)),
|
|
157
|
+
);
|
|
158
|
+
} catch (exp) {
|
|
159
|
+
return exp as Error;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
145
164
|
/**
|
|
146
165
|
* Validate index API.
|
|
147
166
|
*
|