Skip to content

Conversation

@mao-sz
Copy link
Contributor

@mao-sz mao-sz commented Dec 30, 2025

Because

The current way of testing markdownlint custom rules is functional but not the most ideal. Ideal would be automated tests with a runner and against assertions, but until now has been a low priority thing due to potential complexities in testing CLI stuff with third-party libraries.

This is one beefy PR but should be more approachable by reviewing the individual commits, and all tests hopefully passing.
Please do checkout into the PR locally and run npm run test just in case I've made errors with the GH workflow.

This PR

  • Adds Node assertion tests for all markdownlint custom rules
    • Involves many test .md files being renamed/split
  • Excludes markdownlint/ from standard markdownlint GH workflow (intended for lessons/projects)
  • Adds GH workflow specifically for running tests for markdownlint custom rules
  • Updates markdownlint-cli2 minimum version to 0.20.0 due to needing the --format CLI option for tests (released in 0.19.0)

Issue

Closes #30590

Additional information

I can start work on #30575 after this is merged, since the contribution/review protocol will have changed.

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@mao-sz mao-sz added Type: Chore Involves changes with no user-facing value, to the build process/internal tooling, refactors, etc. Content: Markdownlint Involves anything related to the curriculum repo linter labels Dec 30, 2025
@github-actions github-actions bot removed the Type: Chore Involves changes with no user-facing value, to the build process/internal tooling, refactors, etc. label Dec 30, 2025
@mao-sz mao-sz added the Type: Chore Involves changes with no user-facing value, to the build process/internal tooling, refactors, etc. label Dec 30, 2025
@mao-sz
Copy link
Contributor Author

mao-sz commented Dec 30, 2025

I opted to have the custom rule test workflow just run all tests on any custom rule/test file change, rather than try to mess with changed file paths and selectively running tests. That seemed like a hell of a lot of work for little gain, and I'd have to deal with ensuring changes to markdownlint/test_utils/ run all tests still.

For some reason the test workflow uses the TAP test reporter despite it just running npm run test 🤷 The "default" reporter spec is subjectively a touch nicer to read, though arguably not too different.
image

Missing headings not fixable but incorrect heading levels are, so the
test md files should be split.
@mao-sz mao-sz force-pushed the markdownlint-testing branch from 8b9cc87 to 94fc986 Compare December 30, 2025 14:33
@ManonLef ManonLef requested review from a team and JustWaveThings and removed request for a team December 30, 2025 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content: Markdownlint Involves anything related to the curriculum repo linter Type: Chore Involves changes with no user-facing value, to the build process/internal tooling, refactors, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdownlint: Convert tests to automated assertion tests

1 participant