asyncapi / asyncapi/website

[BUG] : In check-markdown.test.js- main() performs real filesystem traversal in tests, making tests environment-dependent and flaky

Open Beginner friendly
#5,031 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
717
Forks
1.2k
Avg merge
1d 12h
Merged PRs (30d)
35

Description

### Describe the bug.

The main() function tests in check-markdown execute real filesystem traversal instead of using mocks. This makes the test suite environment-dependent and potentially flaky when markdown content changes.

### Expected behavior

Tests should mock filesystem access (fs.readdir, fs.readFile)

Test outcomes should depend only on mocked inputs, not repository state

**Actual Behavior**

main() walks real directories during tests

Test outcomes depend on existing markdown files

**Impact**

Risk of flaky CI

Violates test isolation principles

Harder to maintain as documentation grows

### Screenshots

Image
Highlight: no mocks applied

Image

### How to Reproduce

Clone the website repo
Open check-markdown.test.ts
Image
ANALYSE THIS PEICE OF CODE

Image

### 🖥️ Device Information [optional]

- Operating System (OS):WINDOWS 11
- Browser: BRAVE
- Browser Version:

### 👀 Have you checked for similar open issues?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)

### Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Open check-markdown.test.ts and inspect the main() tests, focusing on calls to fs.readdir and fs.readFile. Run the existing test file to observe its filesystem dependence. Done means the tests use mocked filesystem inputs and produce outcomes independent of repository markdown files.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.