Skip to content

Fix tests#465

Merged
di-sukharev merged 3 commits intodi-sukharev:masterfrom
cometjc:fix-tests
Apr 25, 2025
Merged

Fix tests#465
di-sukharev merged 3 commits intodi-sukharev:masterfrom
cometjc:fix-tests

Conversation

@cometjc
Copy link
Copy Markdown
Contributor

@cometjc cometjc commented Apr 25, 2025

  • fix CI test error
  • fix(removeContentTags): keep newlines to preserve formatting

The space normalization logic is updated to replace only multiple spaces
and tabs with a single space, while preserving newlines. This change
ensures that the formatting of the content is maintained, especially
when dealing with empty line requirements and max line length.

cometjc added 3 commits April 25, 2025 18:44
…ved file management

Including rimraf in the project allows for easier and more efficient
removal of files and directories, enhancing the development workflow,
especially for tasks like cleaning up build artifacts.
Resolves persistent `ReferenceError: exports is not defined` errors
encountered during unit tests (`unit-test (20.x)` job) in the GitHub
Actions CI environment. These errors occurred specifically when
importing `cli-testing-library` in the global Jest setup file
(`test/jest-setup.ts`), despite tests passing locally with the same
Node.js version (v20.19.0).

After iterative testing, the following Jest configuration combination
was identified as necessary to ensure consistent ESM handling and test
success in both local and CI environments:

- Set preset to `ts-jest/presets/default-esm` for stricter ESM rules.

- Configured `transformIgnorePatterns` to ensure Jest transforms specific ESM dependencies (`cli-testing-library`, `@clack`, `cleye`) within `node_modules`.

- Expanded the `transform` pattern (`^.+\\.(ts|tsx|js|jsx|mjs)$`) to explicitly cover various script types handled by `ts-jest`.

- Included explicit `tsconfig` overrides (`module: 'ESNext'`, `target: 'ES2022'`) within the `ts-jest` transform options to resolve potential environment discrepancies.

- Retained `moduleNameMapper` for `.js` imports for reliable module resolution.

- Ensured `cli-testing-library` imports remain in the global setup (`test/jest-setup.ts`).

- Removed test cache clearing from the `test:unit` script in `package.json`.

This configuration now passes reliably across environments.
The space normalization logic is updated to replace only multiple spaces
and tabs with a single space, while preserving newlines. This change
ensures that the formatting of the content is maintained, especially
when dealing with empty line requirements and max line length.
@di-sukharev di-sukharev merged commit b277bf3 into di-sukharev:master Apr 25, 2025
5 checks passed
@di-sukharev
Copy link
Copy Markdown
Owner

thank you dude

@cometjc cometjc deleted the fix-tests branch October 30, 2025 03:20
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.

3 participants