Skip to content

fix: raise engines.node to >=22.12.0 - #73

Merged
Shinrai merged 1 commit into
nextfrom
fix/72-node-floor
Oct 4, 2026
Merged

Shinrai merged 1 commit into
nextfrom
fix/72-node-floor

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

  • fix: raise engines.node to >=22.12.0 (434a868)

📦 Dependencies

No dependency updates

🔧 Other Changes

No other changes

👥 Contributors

The runtime dependency chalk 6 declares node >=22, the current vitest peer
(5.x) needs ^22.12.0 || ^24 || >=26, and CI tests from 22.12.0, so the
declared >=20.19.0 floor was never true: Node.js 20 installs warned with
EBADENGINE and failed under engine-strict.

Fixes #72
@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix contributor PR targeting the next integration branch type: dependencies Relates to dependency updates, version bumps, or package management labels Oct 4, 2026
Shinrai added a commit that referenced this pull request Oct 4, 2026
#73 raises engines.node to >=22.12.0 (fixes #72). Record it under
Breaking Changes with the upgrade path (stay on v1.5.1 for Node.js 20),
and update the README Requirements and the What's New Latest block.
@Shinrai
Shinrai merged commit ecd6888 into next Oct 4, 2026
31 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/72-node-floor branch October 4, 2026 01:33
cldmv-bot Bot added a commit that referenced this pull request Oct 4, 2026
# vitest-runner v1.5.3 Changelog

**Release Date**: October 2026
**Release Type**: Patch
**Branch**: `release/1.5.3`

---

## Overview

This release changes how `dist/index.cjs` loads the ES module build. The CommonJS entry no longer goes through `createRequire`, which kept bundlers from seeing the dependency, and it now fails with a clear, actionable error on a Node.js version that cannot `require()` an ES module. New `node:test` checks run the built CommonJS entry point on every test and coverage run.

The ES module build, the CLI and the `run()` API are unchanged, and on Node.js versions with `require(esm)` (20.19+ and 22.12+), `require("@cldmv/vitest-runner")` returns the same named exports as before.

It also raises `engines.node` to `>=22.12.0` ([#73](#73)). The old `>=20.19.0` floor was never true: the runtime dependency `chalk` 6 needs Node.js 22, the current `vitest` 5 peer needs `^22.12.0`, and CI only ever tested 22.12 and later.

---

## 💥 Breaking Changes

### Node.js 20 is no longer supported ([#73](#73), fixes [#72](#72))

`engines.node` moves from `>=20.19.0` to `>=22.12.0`, despite this being a patch release. In practice Node.js 20 already stopped working cleanly in v1.5.2: `chalk` 6.0.1 declares Node.js 22 or later, so Node.js 20 installs printed an `EBADENGINE` warning and failed outright under `engine-strict`, and `vitest` 5 does not install on Node.js 20 at all. The floor now says what the package actually needs.

## 🐛 Bug Fixes

### The CommonJS entry uses a plain `require()` (#69)

`src/cjs-shim.cjs`, which the build copies verbatim to `dist/index.cjs`, loaded `./index.mjs` through `createRequire(__filename)`. A `.cjs` file already has `require`, so `createRequire` added nothing, and it hid the dependency from bundlers such as esbuild and webpack, which detect dependencies from static `require("…")` calls. The shim now calls `require("./index.mjs")` directly and exports its result.

### `require()` fails clearly on Node.js without `require(esm)` (#69)

On a Node.js version without synchronous `require(esm)` (before 20.19 on the 20.x line, or before 22.12), the shim's `require()` threw a generic `ERR_REQUIRE_ESM` that pointed at the package's internals. The shim now checks `process.features.require_module` first and, when it is missing, throws an error with the same `ERR_REQUIRE_ESM` code and a message naming the package, the required versions and the running version:

```text
@cldmv/vitest-runner: require() needs Node.js ^20.19.0 or >=22.12.0 (this is v20.18.0). On older Node.js, load the package with import() instead.
```

Code that catches `ERR_REQUIRE_ESM` by `code` keeps working.

## 🧪 Tests

- New `tests/cjs/entry.test.cjs`, run with `node --test` by a new `test:cjs` script after a fresh `npm run build`. It checks that `require()` of the built package returns the same named exports as `import`, and that the version check throws the new error when `require(esm)` is unavailable.
- `npm test`, `npm run test:coverage` and `npm run ci:coverage` now run `test:cjs` after Vitest, so CI exercises the published CommonJS entry point.

## 📄 License

- The package is relicensed from MIT to [Apache-2.0](https://github.com/CLDMV/vitest-runner/blob/master/LICENSE): `LICENSE` now carries the Apache License 2.0 text and `package.json` declares `"license": "Apache-2.0"`.

## 📚 Documentation

- **NEW:** [docs/changelog/v1/v1.5.3.md](./v1.5.3.md): this changelog.
- **NEW:** changelog files for every earlier release that shipped without one: [v1.0.0](./v1.0.0.md), [v1.0.1](./v1.0.1.md), [v1.0.2](./v1.0.2.md), [v1.0.3](./v1.0.3.md), [v1.1.0](./v1.1.0.md), [v1.2.0](./v1.2.0.md), [v1.3.0](./v1.3.0.md), [v1.3.1](./v1.3.1.md), [v1.3.2](./v1.3.2.md), [v1.3.3](./v1.3.3.md) and [v1.5.2](./v1.5.2.md).
- README restructured to the CLDMV layout (badges, **What's New**, Key Features, Installation with Node.js requirements, Quick Start, then the existing CLI, API and coverage reference). The install commands now use the scoped package name `@cldmv/vitest-runner`, and the Node.js requirement matches `engines.node`.

## 🔧 Dependencies

_No dependency updates._

---

## Upgrade notes

- **Node.js 22.12 or later is required.** On Node.js 20, stay on v1.5.1 (the last release before `chalk` 6), or upgrade Node.js. Everyone already on Node.js 22.12+ gets a drop-in update from [v1.5.2](./v1.5.2.md).
- On a Node.js version without `require(esm)`, `require()` now fails with a clearer message and the same `ERR_REQUIRE_ESM` code.



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-99.5%25-brightgreen?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 99.4% |
| Branches   | 99.6% |
| Functions  | 100.0% |
| Lines      | 99.3% |

*Avg: **99.5%** · `13bf37c` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <Shinrai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

! fix → next v4 flow: fix contributor PR targeting the next integration branch type: dependencies Relates to dependency updates, version bumps, or package management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant