From be2ef0fd4f47767475cacb6fbfa42f13299718c5 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 10 Jul 2024 14:53:49 +0900 Subject: [PATCH] Make `IMigrateRoute` functionn properties to be optional. --- package.json | 5 +++-- src/IMigrateDocument.ts | 2 +- src/IMigrateRoute.ts | 4 ++-- test/index.ts | 14 +++++++++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bdde327..a5fc94d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@samchon/openapi", - "version": "0.3.2", + "version": "0.3.3", "description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", "main": "./lib/index.js", "module": "./lib/index.mjs", @@ -30,11 +30,12 @@ }, "homepage": "https://github.com/samchon/openapi", "devDependencies": { - "@nestia/e2e": "^0.6.0", + "@nestia/e2e": "^0.7.0", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/node": "^20.12.7", + "chalk": "^4.1.2", "prettier": "^3.2.5", "rimraf": "^5.0.5", "rollup": "^4.18.1", diff --git a/src/IMigrateDocument.ts b/src/IMigrateDocument.ts index 89d7230..d3dcfa6 100644 --- a/src/IMigrateDocument.ts +++ b/src/IMigrateDocument.ts @@ -39,7 +39,7 @@ export namespace IMigrateDocument { /** * Target operation causing the error. */ - operation: () => Operation; + operation?: () => Operation; /** * Method of the operation. diff --git a/src/IMigrateRoute.ts b/src/IMigrateRoute.ts index 04e8fc0..824eaf9 100644 --- a/src/IMigrateRoute.ts +++ b/src/IMigrateRoute.ts @@ -161,7 +161,7 @@ export interface IMigrateRoute< * 5. Tag names are added with `@tag` tag. * 6. If {@link OpenApi.IOperation.deprecated}, `@deprecated` tag is added. */ - comment: () => string; + comment?: () => string; /** * Original operation from the OpenAPI document. @@ -169,7 +169,7 @@ export interface IMigrateRoute< * The `operation` is a function returning the original * {@link OpenApi.IOperation} from the {@link OpenAPI} document. */ - operation: () => Operation; + operation?: () => Operation; } export namespace IMigrateRoute { /** diff --git a/test/index.ts b/test/index.ts index ad8fdd7..0416acb 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,11 +1,23 @@ import { DynamicExecutor } from "@nestia/e2e"; +import chalk from "chalk"; const main = async (): Promise => { // DO TEST const report: DynamicExecutor.IReport = await DynamicExecutor.validate({ prefix: "test_", + location: __dirname + "/features", parameters: () => [], - })(__dirname + "/features"); + onComplete: (exec) => { + const trace = (str: string) => + console.log(` - ${chalk.green(exec.name)}: ${str}`); + if (exec.error === null) { + const elapsed: number = + new Date(exec.completed_at).getTime() - + new Date(exec.started_at).getTime(); + trace(`${chalk.yellow(elapsed.toLocaleString())} ms`); + } else trace(chalk.red(exec.error.name)); + }, + }); // REPORT EXCEPTIONS const exceptions: Error[] = report.executions