Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/express/expected/oas.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
"schema": {
"type": "string"
},
"description": "friendName 파라미터"
"description": "friendName parameter"
}
],
"security": [{}],
Expand Down
18 changes: 9 additions & 9 deletions lib/config/readPackageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import * as path from "path"
import logger from "./logger"

/**
* package.json의 "itdoc" 항목 내에서 특정 인자를 읽어옵니다.
* 만약 해당 인자가 존재하지 않으면, 기본값을 반환합니다.
* @param key 조회할 인자명 (.으로 depth 추가 가능)
* @param defaultValue 기본값
* @returns itdoc[key] 값 또는 defaultValue
* Reads a specific argument from the "itdoc" section in package.json.
* If the argument does not exist, returns the default value.
* @param key Argument name to query (depth can be added with .)
* @param defaultValue Default value
* @returns itdoc[key] value or defaultValue
*/
export function readItdocConfig(key: string, defaultValue: string): string {
const packageJson = readPackageJson()
Expand Down Expand Up @@ -51,18 +51,18 @@ export function readItdocConfig(key: string, defaultValue: string): string {
}

/**
* 현재 작업 디렉토리의 `package.json`을 읽어 파싱된 객체를 반환합니다.
* Reads and returns the parsed object of `package.json` from the current working directory.
*
* 읽기 또는 파싱 중 오류가 발생하면 null을 반환하며, 에러 로그를 출력합니다.
* @returns {object | null} 파싱된 package.json 객체 또는 null
* Returns null and outputs error logs if an error occurs during reading or parsing.
* @returns {object | null} Parsed package.json object or null
*/
function readPackageJson(): any {
const packageJsonPath = path.resolve(process.cwd(), "package.json")
try {
const packageJsonData = fs.readFileSync(packageJsonPath, "utf8")
return JSON.parse(packageJsonData)
} catch (error) {
logger.error("package.json을 읽는 중 오류 발생.", error)
logger.error("Error occurred while reading package.json.", error)
return null
}
}
2 changes: 1 addition & 1 deletion lib/dsl/adapters/TestFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/**
* 지원하는 테스트 프레임워크에 대한 Enum
* Enum for supported test frameworks
*/
export enum TestFramework {
Jest = "JEST",
Expand Down
4 changes: 2 additions & 2 deletions lib/dsl/adapters/UserTestInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import { TestFramework } from "./TestFramework"

/**
* 공통 DSL 인터페이스를 정의합니다.
* 실제 테스트 프레임워크의 함수들을 감싸서 동일한 인터페이스를 제공할 수 있도록 합니다.
* Defines common DSL interface.
* Wraps actual test framework functions to provide a unified interface.
*/
export interface UserTestInterface {
name: TestFramework
Expand Down
28 changes: 14 additions & 14 deletions lib/dsl/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TestFramework } from "./TestFramework"
import type { UserTestInterface } from "./UserTestInterface"

/**
* 테스트 프레임워크를 감지하는 동기 함수
* Synchronous function that detects test framework
*/
function detectTestFramework(): TestFramework {
const isJest =
Expand All @@ -44,17 +44,17 @@ function detectTestFramework(): TestFramework {
}

/**
* 동기 방식으로 어댑터를 초기화하는 함수
* Function that initializes adapter synchronously
*/
function initializeAdapterSync(): UserTestInterface {
const framework = detectTestFramework()

switch (framework) {
case TestFramework.Jest: {
/*
참고: Jest의 경우, 반드시 사용할 때만 동적으로 import 해야 합니다.
그렇지 않으면 "Do not import `@jest/globals` outside of the Jest test environment"
에러가 발생하게 됩니다.
Note: For Jest, dynamic imports must only be used when needed.
Otherwise, "Do not import `@jest/globals` outside of the Jest test environment"
error will occur.
*/
const { JestAdapter } = require("./JestAdapter")
return new JestAdapter()
Expand All @@ -73,15 +73,15 @@ function initializeAdapterSync(): UserTestInterface {
}

/**
* 어댑터를 초기화하고 필요한 테스트 메서드들을 반환하는 함수
* 동기 방식으로 동작합니다.
* @returns {object} 테스트 프레임워크의 공통 메서드들
* @property {Function} describeCommon 테스트 스위트를 정의하는 함수
* @property {Function} itCommon 테스트 케이스를 정의하는 함수
* @property {Function} beforeAllCommon 전체 테스트 전에 실행되는 함수
* @property {Function} afterAllCommon 전체 테스트 후에 실행되는 함수
* @property {Function} beforeEachCommon 각 테스트 전에 실행되는 함수
* @property {Function} afterEachCommon 각 테스트 후에 실행되는 함수
* Function that initializes adapter and returns necessary test methods
* Operates synchronously.
* @returns {object} Common methods of test framework
* @property {Function} describeCommon Function that defines test suite
* @property {Function} itCommon Function that defines test case
* @property {Function} beforeAllCommon Function executed before all tests
* @property {Function} afterAllCommon Function executed after all tests
* @property {Function} beforeEachCommon Function executed before each test
* @property {Function} afterEachCommon Function executed after each test
*/
export function getTestAdapterExports(): {
describeCommon: (name: string, fn: () => void) => void
Expand Down
Loading
Loading