Skip to content

Refactor with test-first approach and edge cases#39

Merged
minamorl merged 7 commits intomasterfrom
claude/refactor-test-first-edge-cases-011CV2AoNruMHdGTfv34pZn4
Nov 11, 2025
Merged

Refactor with test-first approach and edge cases#39
minamorl merged 7 commits intomasterfrom
claude/refactor-test-first-edge-cases-011CV2AoNruMHdGTfv34pZn4

Conversation

@minamorl
Copy link
Member

Applied test-driven development approach to improve code quality:

  • Added 49 new edge case tests (106 tests total, all passing)
  • Fixed 6 critical bugs: empty list items, code blocks with backticks, empty table cells, unsafe array.pop(), list unindentation calculation, and empty element HTML rendering
  • Added HTML escaping for XSS protection (escapes &<>"' in attributes)
  • Tests cover: empty inputs, unicode/emoji, security, nested structures, line endings, malformed markdown, and random strings

Applied test-driven development approach to improve code quality:

- Added 49 new edge case tests (106 tests total, all passing)
- Fixed 6 critical bugs: empty list items, code blocks with backticks,
  empty table cells, unsafe array.pop(), list unindentation calculation,
  and empty element HTML rendering
- Added HTML escaping for XSS protection (escapes &<>"' in attributes)
- Tests cover: empty inputs, unicode/emoji, security, nested structures,
  line endings, malformed markdown, and random strings
- Update CircleCI image from deprecated circleci/node:10.8 to cimg/node:16.20
- Switch from yarn to npm ci for faster, more reliable CI builds
- Cache based on package-lock.json instead of package.json
- Bump cache version to v2 to invalidate old caches
- Remove CircleCI configuration
- Add GitHub Actions workflow with matrix testing
- Test on Node.js 16.x, 18.x, and 20.x
- Use actions/checkout@v4 and actions/setup-node@v4
- Enable npm caching for faster builds
- Run tests and build on all PRs and pushes to main/master
- typescript: 3.1.6 -> 5.9.3
- mocha: 5.2.0 -> 11.7.5
- webpack: 4.24.0 -> 5.102.1
- webpack-cli: 3.2.3 -> 6.0.1
- @types/mocha: 5.2.5 -> 10.0.10
- @types/node: 10.12.9 -> 20.19.24
- parsimmon: 1.12.0 -> 1.18.1
- @types/parsimmon: 1.10.0 -> 1.10.9
- @types/power-assert: 1.4.29 -> 1.5.12
- power-assert: 1.4.1 -> 1.6.1

Fixed all 24 vulnerabilities (0 remaining)
All 106 tests passing
Minor version bump warranted by:

Features:
- Added 49 comprehensive edge case tests (106 total tests)
- Added HTML escaping for XSS protection
- Migrated from CircleCI to GitHub Actions with matrix testing

Bug Fixes:
- Fixed empty list items parsing
- Fixed code blocks with backticks inside
- Fixed empty table cells
- Fixed unsafe array.pop() operation
- Fixed list unindentation calculation
- Fixed empty element HTML rendering

Improvements:
- Updated all dependencies to latest versions
- Fixed 24 security vulnerabilities (0 remaining)
- TypeScript 3.1.6 -> 5.9.3
- Mocha 5.2.0 -> 11.7.5
- Webpack 4.24.0 -> 5.102.1

All 106 tests passing. Backwards compatible.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a test-driven development approach to improve code quality and robustness by adding comprehensive edge case testing and fixing several critical bugs in the markdown parser.

  • Added 49 new edge case tests covering empty inputs, unicode/emoji, security (XSS), nested structures, line endings, malformed markdown, and random strings
  • Fixed 6 critical bugs: empty list items, backticks in code blocks, empty table cells, unsafe array.pop(), list unindentation calculation, and empty element HTML rendering
  • Added HTML escaping for XSS protection in attribute values
  • Upgraded development dependencies to modern versions
  • Migrated CI from CircleCI to GitHub Actions

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test-parser.ts Added 49 comprehensive edge case tests covering security, unicode, empty inputs, nested structures, and malformed markdown
src/parser.ts Fixed 6 bugs in regex patterns, array operations, list indentation calculation, and added HTML escaping for XSS protection
package.json Updated all development dependencies to modern versions (mocha 11.x, TypeScript 5.x, webpack 5.x, Node types 20.x)
.github/workflows/ci.yml Added new GitHub Actions CI workflow testing on Node 16.x, 18.x, and 20.x
.circleci/config.yml Removed deprecated CircleCI configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

minamorl and others added 2 commits November 12, 2025 07:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@minamorl minamorl merged commit df93b79 into master Nov 11, 2025
0 of 3 checks passed
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