Skip to content

Fix broken tests on latest Node 26.8 - #150

Merged
alexkli merged 2 commits into
mainfrom
fix-tests
Sep 11, 2026
Merged

alexkli merged 2 commits into
mainfrom
fix-tests

Conversation

@alexkli

@alexkli alexkli commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Tests are broken against latest node versions.

Root cause

Node 26.8.0 rewrote fs.readFile (nodejs/node#65327) so it no longer calls the internal open binding from JavaScript. mock-fs 5.5.0 relies on intercepting that call at require time to find the ReadFileContext prototype. It now gets undefined and throws before any test runs. This is tracked upstream as tschaub/mock-fs#447, opened August 27, still open with no fix. I reproduced the failure locally on Node 26.8.2 with the unmodified test.

Fix

Dropped mock-fs entirely rather than pin Node or wait for upstream. The config tests now create a fresh temp directory, write .sizewatcher.yml into it when needed, and chdir into it. This mirrors the pattern already used in cli.test.js, and the tmp package is already a runtime dependency. Working directory is restored after each test.

Changes

  • removed mock-fs and using a real /tmp directory in tests
  • CI: disable fail-fast on node version matrix, so we alway see all version test results

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Sizewatcher found no problematic size increases.

git -0.1% (553 kB => 553 kB)
Largest files:
Largest files in repository checkout:

346KiB package-lock.json
29KiB README.md
11KiB LICENSE
7.6KiB test/cli.test.js
7.1KiB lib/checkout.js
6.3KiB lib/compare.js
5.0KiB test/mocha-capture-console.js
4.6KiB test/config.test.js
4.5KiB lib/report.js
3.9KiB lib/render.js

Largest files among new changes:

346KiB package-lock.json
4.6KiB test/config.test.js
1.3KiB package.json
809B .github/workflows/node.js.yml
node_modules -0.2% (73.6 MB => 73.4 MB)
Largest production node modules:
@adobe/[email protected] (67 deps, 17.02mb, 1084 files, ©undefined)
╭───────────────────────┬──────────────┬──────────┬───────┬───────────┬────────────┬───────────╮
│ Name │ Dependencies │ Size │ Files │ Native │ License │ Deprec │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
│ @octokit/[email protected] │ 25 │ 11mb │ 378 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ 27 │ 3.21mb │ 367 │ │ ISC │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ 1 │ 1.08mb │ 43 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ 4 │ 934.56kb │ 142 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 74.45kb │ 11 │ │ Apache-2.0 │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ 1 │ 48.35kb │ 11 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 39.3kb │ 4 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 30.43kb │ 11 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 16.87kb │ 40 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 11.65kb │ 5 │ │ MIT │ │
├───────────────────────┼──────────────┼──────────┼───────┼───────────┼────────────┼───────────┤
[email protected] │ │ 11.27kb │ 5 │ │ MIT │ │
╰───────────────────────┴──────────────┴──────────┴───────┴───────────┴────────────┴───────────╯
npm_package has no changes (23.2 kB)
Package contents:
npm notice
📦 @adobe/[email protected]
Tarball Contents
3.1kB CHANGELOG.md
11.3kB LICENSE
29.8kB README.md
743B index.js
7.3kB lib/checkout.js
3.9kB lib/comparators/custom.js
3.6kB lib/comparators/git.js
3.0kB lib/comparators/node_modules.js
2.3kB lib/comparators/npm_package.js
6.4kB lib/compare.js
1.7kB lib/config.js
2.6kB lib/github.js
4.0kB lib/render.js
4.6kB lib/report.js
2.1kB lib/size.js
2.7kB lib/sizewatcher.js
1.3kB package.json
Tarball Details
name: @adobe/sizewatcher
version: 1.4.1
filename: adobe-sizewatcher-1.4.1.tgz
package size: 23.2 kB
unpacked size: 90.5 kB
shasum: 2916faad1ee5fef77fcc95a7e60eb0272c031723
integrity: sha512-t1Wn36F1xUubr[...]EYeV9r93Jc2PQ==
total files: 17
npm notice
Notes
  • PR branch: fix-tests @ 0a95ba4
  • Base branch: main @ e2516cb
  • Sizewatcher v1.4.1
  • Effective Configuration:
limits:
  fail: 100%
  warn: 30%
  ok: '-10%'
report:
  githubComment: true
  githubStatus: false
comparators: {}

@coveralls

coveralls commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 59.677%. remained the same — fix-tests into main

mock-fs 5.5.0 throws at require time on Node 26.8+ because
nodejs/node#65327 rewrote fs.readFile and the prototype sniffing in
mock-fs no longer finds ReadFileContext (tschaub/mock-fs#447, unfixed).

The config tests now write .sizewatcher.yml into a fresh tmp directory
and chdir into it, matching the pattern already used in cli.test.js.
This removes the mock-fs devDependency entirely.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@alexkli alexkli changed the title Fix broken tests Fix broken tests on latest Node 26.8 Sep 11, 2026
@alexkli
alexkli marked this pull request as ready for review September 11, 2026 01:58
@alexkli
alexkli merged commit e5db996 into main Sep 11, 2026
7 checks passed
@alexkli
alexkli deleted the fix-tests branch September 11, 2026 01:58
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