jaywcjlove / jaywcjlove/markdown-to-html-cli

JEST test support ES Module

Open
#28 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
96
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Not yet ready: jest cannot run tests correctly in ESM mode and mocking in our tests will need rework. It's possible to have jest convert everything to CJS, however ESM-only features (e.g. import.meta.url) will then fail instead.

Ref:

- https://jestjs.io/docs/ecmascript-modules
- https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/

Jest ESM support:

- https://github.com/facebook/jest/issues/9430
- https://github.com/nodejs/node/pull/31032
- https://github.com/kulshekhar/ts-jest/issues/1174
- https://github.com/kulshekhar/ts-jest/issues/1709
- https://github.com/facebook/jest/issues/12183#issuecomment-1004320665

Code:

- e6f29fb

Issue:

- https://stackoverflow.com/a/50052194/1334703
- https://nodejs.org/api/esm.html#esm_no_require_exports_module_exports_filename_dirname

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing commit e6f29fb and the linked Jest and ts-jest ESM support documentation. Investigate how the current tests use mocking and ESM-only features such as import.meta.url. Done means Jest runs the test suite correctly in ESM mode without breaking those features or requiring incompatible mocking changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.