Skip to content

test: fuzz parser and source-map invariants - #140

Merged
luojiyin1987 merged 1 commit into
masterfrom
test/fuzz-parser-source-map-invariants
Sep 29, 2026
Merged

luojiyin1987 merged 1 commit into
masterfrom
test/fuzz-parser-source-map-invariants

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

Summary

  • Add fast-check property tests for parser and source-map invariants.
  • Generate normal and malformed Markdown from reusable atoms and constructs.
  • Run 1000 cases with a fixed default seed.
  • Support failure replay through FAST_CHECK_SEED and FAST_CHECK_PATH.
  • Keep production parser code unchanged.

Properties

  • parseMdWithSourceMap() preserves AST parity with parseMd().
  • Every node position stays inside the source bounds.
  • Every supported value code unit has a bounded source range.
  • Value and URL mappings remain monotonic.
  • getRaw() remains consistent with parser positions and whole ranges.
  • Value and URL mutations still produce consistency errors.
  • Autolink URL mappings remain unavailable.

Validation

  • pnpm test: 24 suites and 1979 tests passed.
  • The property test ran 1000 generated documents.
  • pnpm exec eslint __tests__/source-map/fuzz.spec.ts passed.
  • pnpm run test:package passed.

@luojiyin1987

Copy link
Copy Markdown
Contributor Author

Lockfile audit complete. I restored pnpm-lock.yaml from master and ran:

corepack pnpm@11.27.1 add -D fast-check@4.10.2

pnpm 11.27.1 produced a byte-identical lockfile to this PR. The peer-context updates are resolver normalization. I kept the generated result and made no manual lockfile edits. A frozen install also passes.

@luojiyin1987
luojiyin1987 merged commit 7d48da5 into master Sep 29, 2026
14 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.

1 participant