tsに移行#62
Open
Syogo-Suganoya wants to merge 5 commits intomainfrom
Open
Conversation
- src/ に TypeScript ソースを追加(assertions, connection, i18n, records, runner 等) - tsconfig.json を追加し dist/ へのビルドを設定 - package.json: main を dist/index.js に変更、types フィールドを追加、build スクリプトを追加 - devDependencies に typescript / @types/* を追加
Open
Syogo-Suganoya
commented
Apr 15, 2026
Contributor
Author
There was a problem hiding this comment.
元は /lib/assertions.js にあります。
コンテンツのうち、yaml形式でないものはtrack-judge未対応なので、念の為libも残しています。
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}[]
Syogo-Suganoya
commented
Apr 17, 2026
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; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
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 を用意することで、このハックを不要にしました。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.