Skip to content

test: add testcases and coverage - #4

Merged
lxfu1 merged 7 commits into
masterfrom
test-add-testcases
Jul 8, 2026
Merged

test: add testcases and coverage#4
lxfu1 merged 7 commits into
masterfrom
test-add-testcases

Conversation

@hustcc

@hustcc hustcc commented Jul 8, 2026

Copy link
Copy Markdown
Member
  • test: add testcases and coverage 96%+.
  • add HF_ENDPOINT tip

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request significantly expands test coverage across multiple modules (including the embedder, expander, loaders, reranker, storage, and utilities) and reorganizes utility functions, such as moving containsCJK to the tokenizer module. The reviewer feedback highlights several important improvements: cleaning up temporary directories in test/context.test.ts to prevent workspace clutter, reordering setup steps in test/storage/store.test.ts to avoid test instability, using cross-platform paths instead of hardcoded absolute paths in test/utils/sample.test.ts, and correcting the documented type of queryExpansion in the README to match its actual implementation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/context.test.ts
Comment thread test/storage/store.test.ts
Comment thread test/utils/sample.test.ts Outdated
Comment thread README.md Outdated
hustcc and others added 5 commits July 8, 2026 13:55
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@hustcc

hustcc commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@copilot ci 报错了 https://github.com/antvis/context/actions/runs/28921204212/job/85800697202?pr=4

The failures were caused by two issues:

  1. Timeout too short: The 30s testTimeout/hookTimeout wasn't enough for the HuggingFace model (~86MB) to download on a fresh CI runner. The main Context beforeAll timed out → 14 tests skipped. Then Context with reranking / Context with query expansion tests independently tried to load the model and also timed out. Increased both timeouts to 120s in vitest.config.ts.

  2. Concurrent model downloads: When the beforeAll timed out mid-download, subsequent tests found Embedder.pipeline still null and each started its own download. Fixed Embedder.getPipeline() to cache the in-flight Promise (via static pipelinePromise), so all concurrent callers share a single download. On failure, both fields are reset to null to allow retries.

Commit: fix: increase test timeouts and prevent concurrent model downloads in CI

Copilot finished work on behalf of hustcc July 8, 2026 06:34
@lxfu1
lxfu1 self-requested a review July 8, 2026 09:57
@lxfu1
lxfu1 merged commit 05fc4ab into master Jul 8, 2026
2 checks passed
@lxfu1
lxfu1 deleted the test-add-testcases branch July 8, 2026 09:58
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.

3 participants