Skip to content

Add locale key consistency tests for _locales messages.json files#290

Merged
ujiro99 merged 2 commits intomainfrom
copilot/add-language-definition-tests
Feb 25, 2026
Merged

Add locale key consistency tests for _locales messages.json files#290
ujiro99 merged 2 commits intomainfrom
copilot/add-language-definition-tests

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

_locales ディレクトリ配下の各言語定義ファイルに対して、キーの欠落と並び順の不整合を検出するテストが存在しなかった。

Changes

New test: src/test/locales.test.ts

_locales を動的スキャンし、新しい言語追加にも自動対応:

  • LC-01 — ロケールディレクトリが存在すること
  • LC-02 — 全言語が en と同一のキーセットを持つこと(欠落・余剰を両方検出)
  • LC-03 — 全言語のキー順序が en と一致すること
const locales = getLocaleDirs()          // dynamic — picks up new languages automatically
const referenceKeys = Object.keys(loadMessages("en"))

// LC-02: same key set
const missingKeys = referenceKeys.filter((k) => !keys.includes(k))
const extraKeys   = keys.filter((k) => !referenceKeys.includes(k))

// LC-03: same key order
expect(keys).toEqual(referenceKeys)

Locale file fixes

LC-03 で13言語すべて(de, es, fr, hi, id, it, ja, ko, ms, pt_BR, pt_PT, ru, zh_CN)のキー順序が en と乖離していることが判明したため、en の順序に揃えて修正した。

Original prompt

This section details on the original issue you should resolve

<issue_title>拡張機能の言語定義ファイルの欠落をチェックするテストケースを追加する</issue_title>
<issue_description>- https://github.com/ujiro99/selection-command/tree/main/packages%2Fextension%2Fpublic%2F_locales配下に存在する言語定義ファイルについて、キーの抜け、キーの並び順をチェックする単体テストを作成する

  • 言語自体が追加された場合も柔軟に対応出来るようにする</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…iles

Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test cases to check missing language definition files Add locale key consistency tests for _locales messages.json files Feb 24, 2026
Copilot AI requested a review from ujiro99 February 24, 2026 23:02
@ujiro99 ujiro99 marked this pull request as ready for review February 25, 2026 03:27
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.10%. Comparing base (a502533) to head (3e91c4e).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #290   +/-   ##
=======================================
  Coverage   19.10%   19.10%           
=======================================
  Files         308      308           
  Lines       28730    28730           
  Branches     1317     1317           
=======================================
  Hits         5488     5488           
  Misses      23242    23242           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ujiro99 ujiro99 merged commit 68f723c into main Feb 25, 2026
7 checks passed
@ujiro99 ujiro99 deleted the copilot/add-language-definition-tests branch February 25, 2026 03:38
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.

拡張機能の言語定義ファイルの欠落をチェックするテストケースを追加する

2 participants