@nestia/e2e 0.1.1 → 0.1.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.
@@ -40,6 +40,13 @@ export declare namespace DynamicExecutor {
40
40
  * @returns Parameters
41
41
  */
42
42
  parameters: (name: string) => Parameters;
43
+ /**
44
+ * Filter function whether to run or not.
45
+ *
46
+ * @param name Function name
47
+ * @returns Whether to run or not
48
+ */
49
+ filter?: (name: string) => boolean;
43
50
  /**
44
51
  * Wrapper of test function.
45
52
  *
@@ -100,7 +100,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
100
100
  Object.defineProperty(exports, "__esModule", { value: true });
101
101
  exports.DynamicExecutor = void 0;
102
102
  var chalk_1 = __importDefault(require("chalk"));
103
- var cli_1 = __importDefault(require("cli"));
104
103
  var fs_1 = __importDefault(require("fs"));
105
104
  var path_1 = __importDefault(require("path"));
106
105
  var StopWatch_1 = require("./StopWatch");
@@ -164,17 +163,16 @@ var DynamicExecutor;
164
163
  var main = function (options) {
165
164
  return function (assert) {
166
165
  return function (path) { return __awaiter(_this, void 0, void 0, function () {
167
- var command, report, executor, iterator;
166
+ var report, executor, iterator;
168
167
  return __generator(this, function (_a) {
169
168
  switch (_a.label) {
170
169
  case 0:
171
- command = cli_1.default.parse();
172
170
  report = {
173
171
  location: path,
174
172
  time: Date.now(),
175
173
  executions: [],
176
174
  };
177
- executor = execute(options)(command)(report)(assert);
175
+ executor = execute(options)(report)(assert);
178
176
  iterator = iterate(executor);
179
177
  return [4 /*yield*/, iterator(path)];
180
178
  case 1:
@@ -245,111 +243,107 @@ var DynamicExecutor;
245
243
  return visitor;
246
244
  };
247
245
  var execute = function (options) {
248
- return function (command) {
249
- return function (report) {
250
- return function (assert) {
251
- return function (location, modulo) { return __awaiter(_this, void 0, void 0, function () {
252
- var _loop_1, _a, _b, _c, _i, key, state_1;
253
- var _this = this;
254
- return __generator(this, function (_d) {
255
- switch (_d.label) {
256
- case 0:
257
- _loop_1 = function (key) {
258
- var closure, func, label, result, _e, exp_1;
259
- return __generator(this, function (_f) {
260
- switch (_f.label) {
261
- case 0:
262
- if (command.exclude && key.indexOf(command.exclude) !== -1)
263
- return [2 /*return*/, "continue"];
264
- else if (command.include && key.indexOf(command.include) === -1)
265
- return [2 /*return*/, "continue"];
266
- else if (key.substring(0, options.prefix.length) !== options.prefix)
267
- return [2 /*return*/, "continue"];
268
- else if (!(modulo[key] instanceof Function))
269
- return [2 /*return*/, "continue"];
270
- closure = modulo[key];
271
- func = function () { return __awaiter(_this, void 0, void 0, function () {
272
- return __generator(this, function (_a) {
273
- switch (_a.label) {
274
- case 0:
275
- if (!(options.wrapper !== undefined)) return [3 /*break*/, 2];
276
- return [4 /*yield*/, options.wrapper(key, closure)];
277
- case 1:
278
- _a.sent();
279
- return [3 /*break*/, 4];
280
- case 2: return [4 /*yield*/, closure.apply(void 0, __spreadArray([], __read(options.parameters(key)), false))];
281
- case 3:
282
- _a.sent();
283
- _a.label = 4;
284
- case 4: return [2 /*return*/];
285
- }
286
- });
287
- }); };
288
- label = chalk_1.default.greenBright(key);
289
- result = {
290
- name: key,
291
- location: location,
292
- error: null,
293
- time: Date.now(),
294
- };
295
- report.executions.push(result);
296
- _f.label = 1;
297
- case 1:
298
- _f.trys.push([1, 6, , 7]);
299
- if (!(options.showElapsedTime === false)) return [3 /*break*/, 3];
300
- return [4 /*yield*/, func()];
301
- case 2:
302
- _f.sent();
303
- result.time = Date.now() - result.time;
304
- console.log(" - ".concat(label));
305
- return [3 /*break*/, 5];
306
- case 3:
307
- _e = result;
308
- return [4 /*yield*/, StopWatch_1.StopWatch.measure(func)];
309
- case 4:
310
- _e.time = _f.sent();
311
- console.log(" - ".concat(label, ": ").concat(chalk_1.default.yellowBright(result.time.toLocaleString()), " ms"));
312
- _f.label = 5;
313
- case 5: return [3 /*break*/, 7];
314
- case 6:
315
- exp_1 = _f.sent();
316
- if (!(exp_1 instanceof Error))
317
- return [2 /*return*/, { value: void 0 }];
318
- result.time = Date.now() - result.time;
319
- result.error = exp_1;
320
- console.log(" - ".concat(label, " -> ").concat(chalk_1.default.redBright(exp_1.name)));
321
- if (assert === true)
322
- throw exp_1;
323
- return [3 /*break*/, 7];
324
- case 7: return [2 /*return*/];
325
- }
326
- });
327
- };
328
- _a = modulo;
329
- _b = [];
330
- for (_c in _a)
331
- _b.push(_c);
332
- _i = 0;
333
- _d.label = 1;
334
- case 1:
335
- if (!(_i < _b.length)) return [3 /*break*/, 4];
336
- _c = _b[_i];
337
- if (!(_c in _a)) return [3 /*break*/, 3];
338
- key = _c;
339
- return [5 /*yield**/, _loop_1(key)];
340
- case 2:
341
- state_1 = _d.sent();
342
- if (typeof state_1 === "object")
343
- return [2 /*return*/, state_1.value];
344
- _d.label = 3;
345
- case 3:
346
- _i++;
347
- return [3 /*break*/, 1];
348
- case 4: return [2 /*return*/];
349
- }
350
- });
351
- }); };
352
- };
246
+ return function (report) {
247
+ return function (assert) {
248
+ return function (location, modulo) { return __awaiter(_this, void 0, void 0, function () {
249
+ var _loop_1, _a, _b, _c, _i, key, state_1;
250
+ var _this = this;
251
+ return __generator(this, function (_d) {
252
+ switch (_d.label) {
253
+ case 0:
254
+ _loop_1 = function (key) {
255
+ var closure, func, label, result, _e, exp_1;
256
+ return __generator(this, function (_f) {
257
+ switch (_f.label) {
258
+ case 0:
259
+ if (key.substring(0, options.prefix.length) !== options.prefix)
260
+ return [2 /*return*/, "continue"];
261
+ else if (!(modulo[key] instanceof Function))
262
+ return [2 /*return*/, "continue"];
263
+ else if (options.filter && options.filter(key) === false)
264
+ return [2 /*return*/, "continue"];
265
+ closure = modulo[key];
266
+ func = function () { return __awaiter(_this, void 0, void 0, function () {
267
+ return __generator(this, function (_a) {
268
+ switch (_a.label) {
269
+ case 0:
270
+ if (!(options.wrapper !== undefined)) return [3 /*break*/, 2];
271
+ return [4 /*yield*/, options.wrapper(key, closure)];
272
+ case 1:
273
+ _a.sent();
274
+ return [3 /*break*/, 4];
275
+ case 2: return [4 /*yield*/, closure.apply(void 0, __spreadArray([], __read(options.parameters(key)), false))];
276
+ case 3:
277
+ _a.sent();
278
+ _a.label = 4;
279
+ case 4: return [2 /*return*/];
280
+ }
281
+ });
282
+ }); };
283
+ label = chalk_1.default.greenBright(key);
284
+ result = {
285
+ name: key,
286
+ location: location,
287
+ error: null,
288
+ time: Date.now(),
289
+ };
290
+ report.executions.push(result);
291
+ _f.label = 1;
292
+ case 1:
293
+ _f.trys.push([1, 6, , 7]);
294
+ if (!(options.showElapsedTime === false)) return [3 /*break*/, 3];
295
+ return [4 /*yield*/, func()];
296
+ case 2:
297
+ _f.sent();
298
+ result.time = Date.now() - result.time;
299
+ console.log(" - ".concat(label));
300
+ return [3 /*break*/, 5];
301
+ case 3:
302
+ _e = result;
303
+ return [4 /*yield*/, StopWatch_1.StopWatch.measure(func)];
304
+ case 4:
305
+ _e.time = _f.sent();
306
+ console.log(" - ".concat(label, ": ").concat(chalk_1.default.yellowBright(result.time.toLocaleString()), " ms"));
307
+ _f.label = 5;
308
+ case 5: return [3 /*break*/, 7];
309
+ case 6:
310
+ exp_1 = _f.sent();
311
+ if (!(exp_1 instanceof Error))
312
+ return [2 /*return*/, { value: void 0 }];
313
+ result.time = Date.now() - result.time;
314
+ result.error = exp_1;
315
+ console.log(" - ".concat(label, " -> ").concat(chalk_1.default.redBright(exp_1.name)));
316
+ if (assert === true)
317
+ throw exp_1;
318
+ return [3 /*break*/, 7];
319
+ case 7: return [2 /*return*/];
320
+ }
321
+ });
322
+ };
323
+ _a = modulo;
324
+ _b = [];
325
+ for (_c in _a)
326
+ _b.push(_c);
327
+ _i = 0;
328
+ _d.label = 1;
329
+ case 1:
330
+ if (!(_i < _b.length)) return [3 /*break*/, 4];
331
+ _c = _b[_i];
332
+ if (!(_c in _a)) return [3 /*break*/, 3];
333
+ key = _c;
334
+ return [5 /*yield**/, _loop_1(key)];
335
+ case 2:
336
+ state_1 = _d.sent();
337
+ if (typeof state_1 === "object")
338
+ return [2 /*return*/, state_1.value];
339
+ _d.label = 3;
340
+ case 3:
341
+ _i++;
342
+ return [3 /*break*/, 1];
343
+ case 4: return [2 /*return*/];
344
+ }
345
+ });
346
+ }); };
353
347
  };
354
348
  };
355
349
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicExecutor.js","sourceRoot":"","sources":["../src/DynamicExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,4CAAsB;AACtB,0CAAoB;AACpB,8CAA4B;AAE5B,yCAAwC;AAExC;;;;;;;;;;;;GAYG;AACH,IAAiB,eAAe,CAyP/B;AAzPD,WAAiB,eAAe;;IAsG5B;;;;;;;;;OASG;IACU,sBAAM,GACf,UAA0B,OAA4B;QACtD;;;;WAIG;QACH,OAAA,UAAC,IAAY;YACT,OAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAAzB,CAAyB;IAD7B,CAC6B,CAAC;IAElC;;;;;;;;;OASG;IACU,wBAAQ,GACjB,UAA0B,OAA4B;QACtD;;;;;WAKG;QACH,OAAA,UAAC,IAAY;YACT,OAAA,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QAA1B,CAA0B;IAD9B,CAC8B,CAAC;IAEnC,IAAM,IAAI,GACN,UAA0B,OAA4B;QACtD,OAAA,UAAC,MAAe;YAChB,OAAA,UAAO,IAAY;;;;;4BACT,OAAO,GAAa,aAAG,CAAC,KAAK,EAAE,CAAC;4BAChC,MAAM,GAAY;gCACpB,QAAQ,EAAE,IAAI;gCACd,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;gCAChB,UAAU,EAAE,EAAE;6BACjB,CAAC;4BAEI,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,C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C,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;gDACvC,MAAM,CAAC,KAAK,GAAG,KAAG,CAAC;gDAEnB,OAAO,CAAC,GAAG,CAAC,cAAO,KAAK,iBAAO,eAAK,CAAC,SAAS,CAAC,KAAG,CAAC,IAAI,CAAC,CAAE,CAAC,CAAC;gDAC5D,IAAI,MAAM,KAAK,IAAI;oDAAE,MAAM,KAAG,CAAC;;;;;;qCA3CrB,MAAM;;;;;;;;;;;8DAAb,GAAG;;;;;;;;;;;;qBA8CjB;YA/CD,CA+CC;QAhDD,CAgDC;IAjDD,CAiDC,CAAC;IAKN,IAAM,SAAS,GAAW,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC1E,CAAC,EAvPgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAuP/B"}
package/package.json CHANGED
@@ -1,52 +1,52 @@
1
- {
2
- "name": "@nestia/e2e",
3
- "version": "0.1.1",
4
- "description": "E2E test utilify functions",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "build": "rimraf lib && tsc",
8
- "dev": "npm run build -- --watch",
9
- "prettier": "prettier --write ./src/**/*.ts",
10
- "test": "node lib/test"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/samchon/nestia"
15
- },
16
- "keywords": [
17
- "e2e",
18
- "nestia",
19
- "nestjs",
20
- "test",
21
- "tdd",
22
- "utility"
23
- ],
24
- "author": "Jeongho Nam",
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/samchon/nestia/issues"
28
- },
29
- "homepage": "https://github.com/samchon/nestia#readme",
30
- "devDependencies": {
31
- "@trivago/prettier-plugin-sort-imports": "^4.0.0",
32
- "@types/cli": "^0.11.21",
33
- "@types/node": "^18.11.18",
34
- "prettier": "^2.8.3",
35
- "rimraf": "^4.1.2",
36
- "typescript": "^4.9.5"
37
- },
38
- "dependencies": {
39
- "chalk": "^4.1.2",
40
- "cli": "^1.0.1",
41
- "tstl": "^2.5.13"
42
- },
43
- "files": [
44
- "lib",
45
- "src",
46
- "!lib/test",
47
- "!src/test",
48
- "README.md",
49
- "LICENSE",
50
- "package.json"
51
- ]
52
- }
1
+ {
2
+ "name": "@nestia/e2e",
3
+ "version": "0.1.2",
4
+ "description": "E2E test utilify functions",
5
+ "main": "lib/index.js",
6
+ "scripts": {
7
+ "build": "rimraf lib && tsc",
8
+ "dev": "npm run build -- --watch",
9
+ "prettier": "prettier --write ./src/**/*.ts",
10
+ "test": "node lib/test"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/samchon/nestia"
15
+ },
16
+ "keywords": [
17
+ "e2e",
18
+ "nestia",
19
+ "nestjs",
20
+ "test",
21
+ "tdd",
22
+ "utility"
23
+ ],
24
+ "author": "Jeongho Nam",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/samchon/nestia/issues"
28
+ },
29
+ "homepage": "https://github.com/samchon/nestia#readme",
30
+ "devDependencies": {
31
+ "@trivago/prettier-plugin-sort-imports": "^4.0.0",
32
+ "@types/cli": "^0.11.21",
33
+ "@types/node": "^18.11.18",
34
+ "prettier": "^2.8.3",
35
+ "rimraf": "^4.1.2",
36
+ "typescript": "^4.9.5"
37
+ },
38
+ "dependencies": {
39
+ "chalk": "^4.1.2",
40
+ "cli": "^1.0.1",
41
+ "tstl": "^2.5.13"
42
+ },
43
+ "files": [
44
+ "lib",
45
+ "src",
46
+ "!lib/test",
47
+ "!src/test",
48
+ "README.md",
49
+ "LICENSE",
50
+ "package.json"
51
+ ]
52
+ }
package/src/ArrayUtil.ts CHANGED
@@ -1,87 +1,87 @@
1
- /**
2
- * Utility functions for arrays.
3
- *
4
- * @author Jeongho Nam - https://github.com/samchon
5
- */
6
- export namespace ArrayUtil {
7
- export async function asyncFilter<Input>(
8
- elements: readonly Input[],
9
- pred: (
10
- elem: Input,
11
- index: number,
12
- array: readonly Input[],
13
- ) => Promise<boolean>,
14
- ): Promise<Input[]> {
15
- const ret: Input[] = [];
16
- await asyncForEach(elements, async (elem, index, array) => {
17
- const flag: boolean = await pred(elem, index, array);
18
- if (flag === true) ret.push(elem);
19
- });
20
- return ret;
21
- }
22
-
23
- export async function asyncForEach<Input>(
24
- elements: readonly Input[],
25
- closure: (
26
- elem: Input,
27
- index: number,
28
- array: readonly Input[],
29
- ) => Promise<any>,
30
- ): Promise<void> {
31
- await asyncRepeat(elements.length, (index) =>
32
- closure(elements[index], index, elements),
33
- );
34
- }
35
-
36
- export async function asyncMap<Input, Output>(
37
- elements: readonly Input[],
38
- closure: (
39
- elem: Input,
40
- index: number,
41
- array: readonly Input[],
42
- ) => Promise<Output>,
43
- ): Promise<Output[]> {
44
- const ret: Output[] = [];
45
- await asyncForEach(elements, async (elem, index, array) => {
46
- const output: Output = await closure(elem, index, array);
47
- ret.push(output);
48
- });
49
- return ret;
50
- }
51
-
52
- export async function asyncRepeat<T>(
53
- count: number,
54
- closure: (index: number) => Promise<T>,
55
- ): Promise<T[]> {
56
- const indexes: number[] = new Array(count)
57
- .fill(1)
58
- .map((_, index) => index);
59
-
60
- const output: T[] = [];
61
- for (const index of indexes) output.push(await closure(index));
62
-
63
- return output;
64
- }
65
-
66
- export function has<T>(
67
- elements: readonly T[],
68
- pred: (elem: T) => boolean,
69
- ): boolean {
70
- return elements.find(pred) !== undefined;
71
- }
72
-
73
- export function repeat<T>(
74
- count: number,
75
- closure: (index: number) => T,
76
- ): T[] {
77
- return new Array(count).fill("").map((_, index) => closure(index));
78
- }
79
-
80
- export function last<T>(array: T[]): T {
81
- return array[array.length - 1];
82
- }
83
-
84
- export function flat<T>(matrix: T[][]): T[] {
85
- return ([] as T[]).concat(...matrix);
86
- }
87
- }
1
+ /**
2
+ * Utility functions for arrays.
3
+ *
4
+ * @author Jeongho Nam - https://github.com/samchon
5
+ */
6
+ export namespace ArrayUtil {
7
+ export async function asyncFilter<Input>(
8
+ elements: readonly Input[],
9
+ pred: (
10
+ elem: Input,
11
+ index: number,
12
+ array: readonly Input[],
13
+ ) => Promise<boolean>,
14
+ ): Promise<Input[]> {
15
+ const ret: Input[] = [];
16
+ await asyncForEach(elements, async (elem, index, array) => {
17
+ const flag: boolean = await pred(elem, index, array);
18
+ if (flag === true) ret.push(elem);
19
+ });
20
+ return ret;
21
+ }
22
+
23
+ export async function asyncForEach<Input>(
24
+ elements: readonly Input[],
25
+ closure: (
26
+ elem: Input,
27
+ index: number,
28
+ array: readonly Input[],
29
+ ) => Promise<any>,
30
+ ): Promise<void> {
31
+ await asyncRepeat(elements.length, (index) =>
32
+ closure(elements[index], index, elements),
33
+ );
34
+ }
35
+
36
+ export async function asyncMap<Input, Output>(
37
+ elements: readonly Input[],
38
+ closure: (
39
+ elem: Input,
40
+ index: number,
41
+ array: readonly Input[],
42
+ ) => Promise<Output>,
43
+ ): Promise<Output[]> {
44
+ const ret: Output[] = [];
45
+ await asyncForEach(elements, async (elem, index, array) => {
46
+ const output: Output = await closure(elem, index, array);
47
+ ret.push(output);
48
+ });
49
+ return ret;
50
+ }
51
+
52
+ export async function asyncRepeat<T>(
53
+ count: number,
54
+ closure: (index: number) => Promise<T>,
55
+ ): Promise<T[]> {
56
+ const indexes: number[] = new Array(count)
57
+ .fill(1)
58
+ .map((_, index) => index);
59
+
60
+ const output: T[] = [];
61
+ for (const index of indexes) output.push(await closure(index));
62
+
63
+ return output;
64
+ }
65
+
66
+ export function has<T>(
67
+ elements: readonly T[],
68
+ pred: (elem: T) => boolean,
69
+ ): boolean {
70
+ return elements.find(pred) !== undefined;
71
+ }
72
+
73
+ export function repeat<T>(
74
+ count: number,
75
+ closure: (index: number) => T,
76
+ ): T[] {
77
+ return new Array(count).fill("").map((_, index) => closure(index));
78
+ }
79
+
80
+ export function last<T>(array: T[]): T {
81
+ return array[array.length - 1];
82
+ }
83
+
84
+ export function flat<T>(matrix: T[][]): T[] {
85
+ return ([] as T[]).concat(...matrix);
86
+ }
87
+ }