Skip to content

fix(front-matter): accept readonly array in test() - #7364

Open
dannyshafer wants to merge 1 commit into
denoland:mainfrom
dannyshafer:front-matter-test-readonly
Open

dannyshafer wants to merge 1 commit into
denoland:mainfrom
dannyshafer:front-matter-test-readonly

Conversation

@dannyshafer

Copy link
Copy Markdown

Summary

test() in @std/front-matter now takes formats?: readonly Format[] instead of Format[]. Instead of reassigning the parameter when it is omitted, it iterates over formats ?? EXTRACT_REGEXP_MAP.keys(), so behavior is unchanged.

Motivation

Part of #5831. test() never mutates formats, so callers holding a readonly array (for example ["yaml"] as const) currently get a type error for no reason. Other modules have already been updated the same way (#5832, #5735, #6639, #6911).

Test plan

  • Added test() accepts readonly formats to front_matter/test_test.ts. It fails type-checking (TS2345) without the change and passes with it.
  • deno test --doc front_matter/: 45 passed, 0 failed.
  • deno fmt --check front_matter/ and deno lint front_matter/ are clean.

This PR was prepared with an AI coding agent (Claude Code).

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.04%. Comparing base (f834d02) to head (7f0c3ca).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7364    +/-   ##
========================================
  Coverage   95.04%   95.04%            
========================================
  Files         619      619            
  Lines       52012    51760   -252     
  Branches     9450     9401    -49     
========================================
- Hits        49434    49195   -239     
+ Misses       2031     2022     -9     
+ Partials      547      543     -4     

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants