Skip to content

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

Closed
anilkk wants to merge 1 commit into
brightdata:mainfrom
anilkk:fix/node24-test-script
Closed

anilkk wants to merge 1 commit into
brightdata:mainfrom
anilkk:fix/node24-test-script

Conversation

@anilkk

@anilkk anilkk commented Nov 24, 2026

Copy link
Copy Markdown

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 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #2 (same fix, committed from the anil-bd account).

@anil-bd anil-bd closed this Nov 24, 2026
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