Skip to content

fix(generator): log a failing generate() also without testcaseMeta - #67

Merged
pa201608 merged 1 commit into
masterfrom
fix/generate-without-meta
Oct 3, 2026
Merged

pa201608 merged 1 commit into
masterfrom
fix/generate-without-meta

Conversation

@pa201608

@pa201608 pa201608 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Found by the lektorat of the regenerated website API pages: the testing sample in docs/api/logger.md (added in #66) did not run. DataGeneratorBase.generate() catches an error of doGenerate() to log it, but its catch block read generatorDirective.testcaseMeta.tableName unguarded. A directive built by hand (a test, a direct call) has no testcaseMeta, so the handler itself threw Cannot read properties of undefined (reading 'tableName') instead of logging and returning undefined. In a processor run testcaseMeta is always set, so only direct callers were affected.

Fix: optional chaining in the catch block; tableName/fieldName fall back to 'unknown' as before.

Small doc fixes from the same lektorat: processor options writeStaticData/writeMetaData, parameter names in the cellValue table, no eslint comment in a sample, continuation notes on two fragment samples.

Test plan

  • new test: a rejecting doGenerate() with a directive without testcaseMeta is logged and returns undefined; fails against the old code
  • format, lint, typecheck, vitest (216 tests)
  • the logger testing sample, executed with vitest against the build: passes
  • documented results executed (filters, logger levels, counter cache, ranges, default registry): all hold

After merge (→ 3.3.1) the website API pages are regenerated.

🤖 Generated with Claude Code

The catch block of DataGeneratorBase.generate() read
generatorDirective.testcaseMeta.tableName unguarded. A directive built
by hand (a test, a direct call) has no testcaseMeta, so the error
handler threw itself instead of logging the error and returning
undefined. The testing sample in docs/api/logger.md hit exactly that.

Docs, from the lektorat of the regenerated website pages:
- processor: options writeStaticData / writeMetaData; the multiple
  writers sample says it continues the examples above
- file-processor: parameter table uses columnNumber / rowNumber
- data-generator: no eslint comment in the sample
- guide/overview: the processor sample says what it continues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pa201608
pa201608 merged commit d916a7d into master Oct 3, 2026
2 checks passed
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant