Skip to content

fix: npm test fails on Node 24 (publish workflow) - #2

Merged
anil-bd merged 1 commit into
mainfrom
fix/node24-test-script
Nov 24, 2026
Merged

anil-bd merged 1 commit into
mainfrom
fix/node24-test-script

Conversation

@anil-bd

@anil-bd anil-bd commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Publish to npm run for 0.1.0 failed at npm test:

Error: Cannot find module '/home/runner/work/instagram-scraper-node/instagram-scraper-node/tests'

publish.yml runs on Node 24. Since Node 22, a path passed to node --test is treated as a file (or glob), not a directory, so node --test tests/ runs zero tests and fails. ci.yml runs on Node 20, which still accepts a directory, so CI stayed green on the same commit.

Fix

"test": "node --test tests/" → "test": "node --test". With no argument, Node auto-discovers **/*.test.js (excluding node_modules) on every supported version.

Verified

  • Node 20.20.2: 21/21 pass
  • Node 24: 21/21 pass (old script reproduces the MODULE_NOT_FOUND error)

After merge, the npm publish for 0.1.0 needs to be re-run.

🤖 Generated with Claude Code

Node 22+ treats a path passed to --test as a file, so 'node --test tests/'
fails on Node 24 (used by the publish workflow) with MODULE_NOT_FOUND.
Plain 'node --test' auto-discovers tests/*.test.js on Node 20 and 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anil-bd
anil-bd merged commit b5d3b32 into main Nov 24, 2026
7 checks passed
@anil-bd
anil-bd deleted the fix/node24-test-script branch November 24, 2026 07:13
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.

1 participant