Skip to content

fix(graphql): drop ESM-broken _checkRequirements() so check works (#5654)#5658

Merged
DavertMik merged 1 commit into
4.xfrom
fix/5654-graphql-check-requirements
Jul 6, 2026
Merged

fix(graphql): drop ESM-broken _checkRequirements() so check works (#5654)#5658
DavertMik merged 1 commit into
4.xfrom
fix/5654-graphql-check-requirements

Conversation

@DavertMik

@DavertMik DavertMik commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #5654

Problem

Running npx codeceptjs check with the GraphQL helper configured throws a false error:

Error: Required modules are not installed.

RUN: [sudo] npm install -g axios

even when axios is installed.

Root cause

GraphQL._checkRequirements() (and GraphQLDataFactory._checkRequirements()) called require('axios'). In the ESM build require is undefined, so the line throws ReferenceError: require is not defined. The surrounding catch swallows it and returns the dependency list as "missing" — a false positive. container.js's checkHelperRequirements() then throws and blocks the command.

Fix

Delete _checkRequirements() from both helpers entirely. Dependencies are imported at the top of each ESM module, so a genuinely missing dependency fails at import time — the runtime check is redundant. Both call sites (container.js:checkHelperRequirements, command/init.js) already guard with if (Helper._checkRequirements), so removing the method is safe.

Verification

Both helpers load, and _checkRequirements is now undefined (skipped by the guards):

GraphQL._checkRequirements is undefined
GraphQLDataFactory._checkRequirements is undefined

npx codeceptjs check no longer reports axios/rosie as missing.

🤖 Generated with Claude Code

…5654)

_checkRequirements() called require('axios'), which is undefined in ESM.
The ReferenceError was caught and reported the deps as missing, so
`npx codeceptjs check` failed with a false 'axios not installed' error.
Both call sites (container.js, init.js) guard with `if (._checkRequirements)`,
and missing deps already fail at import time, so the method is just removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DavertMik DavertMik force-pushed the fix/5654-graphql-check-requirements branch from 318114d to d596270 Compare July 5, 2026 23:15
@DavertMik DavertMik changed the title fix(graphql): remove ESM-broken require() check so check works (#5654) fix(graphql): drop ESM-broken _checkRequirements() so check works (#5654) Jul 5, 2026
@DavertMik DavertMik merged commit 6e4b176 into 4.x Jul 6, 2026
12 of 13 checks passed
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.

GraphQL helper: false "axios not installed" error due to require() in ESM context (CodeceptJS 4.0.8)

1 participant