Skip to content

tsに移行#62

Open
Syogo-Suganoya wants to merge 5 commits intomainfrom
feat/typescript-migration
Open

tsに移行#62
Syogo-Suganoya wants to merge 5 commits intomainfrom
feat/typescript-migration

Conversation

@Syogo-Suganoya
Copy link
Copy Markdown
Contributor

No description provided.

- src/ に TypeScript ソースを追加(assertions, connection, i18n, records, runner 等)
- tsconfig.json を追加し dist/ へのビルドを設定
- package.json: main を dist/index.js に変更、types フィールドを追加、build スクリプトを追加
- devDependencies に typescript / @types/* を追加
@Syogo-Suganoya Syogo-Suganoya self-assigned this Apr 15, 2026
@Syogo-Suganoya Syogo-Suganoya linked an issue Apr 15, 2026 that may be closed by this pull request
Comment thread src/assertions.ts
Copy link
Copy Markdown
Contributor Author

@Syogo-Suganoya Syogo-Suganoya Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

元は /lib/assertions.js にあります。
コンテンツのうち、yaml形式でないものはtrack-judge未対応なので、念の為libも残しています。

@Syogo-Suganoya
Copy link
Copy Markdown
Contributor Author

@shunjikonishi review me

…tern

Previously, callers had to override global describe/it to capture testcases.
getTestcases() exposes them directly as {title, fn, timeout}[]
Comment thread src/runner.ts
Comment on lines +430 to +450
getTestcases(): Array<{ title: string; fn: () => Promise<void>; timeout: number }> {
const settings = this.yaml.settings ?? {};
const max_display_rows = settings.max_display_rows;
if (max_display_rows === 'unlimited') {
assertions.options.limit = Infinity;
} else if (isFinite(max_display_rows)) {
assertions.options.limit = Number(max_display_rows);
}

const result: Array<{ title: string; fn: () => Promise<void>; timeout: number }> = [];
for (const testcase of this.yaml.testcases) {
preprocess(testcase).forEach((tc: any) => {
result.push({
title: __(tc.title) || '',
fn: async () => { await executeTestcase(this.yaml.client, tc); },
timeout: Connection.timeout(this.yaml.client, tc.timeout),
});
});
}
return result;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/givery-technology/track-db-test-library/blob/873c2da50781cb48ab3480a9140b5b18bcf494bd/lib/runner.js から getTestcases を追加しました。

従来、track-judge 側でテストケースを収集するには mocha のグローバル関数(describe/it)を差し替えてフックするという迂回策が必要でした。TestRunner が内部で使うテストケース一覧を { title, fn, timeout }[] 形式で直接返す公開 API を用意することで、このハックを不要にしました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsに移行

1 participant