Skip to content

Fix TypeError: indent is not a function with indent-string v5#150

Merged
jens-maus merged 1 commit intomasterfrom
copilot/analyze-ci-workflow-errors
Apr 2, 2026
Merged

Fix TypeError: indent is not a function with indent-string v5#150
jens-maus merged 1 commit intomasterfrom
copilot/analyze-ci-workflow-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

indent-string v5 is pure ESM. When loaded via CommonJS require() on Node.js 22+, it returns { default: fn } instead of fn directly, causing TypeError: indent is not a function in tests (surfaced by PR #55's version bump from v4 → v5).

Changes

  • lib/helper.js: Replace direct require('indent-string') assignment with an ESM-compat shim:
const indentStringModule = require('indent-string');
const indent = indentStringModule.default || indentStringModule;

Backward-compatible with v4 (where require returns the function directly).

@jens-maus jens-maus marked this pull request as ready for review April 2, 2026 21:44
@jens-maus jens-maus merged commit d1d5eac into master Apr 2, 2026
7 of 9 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