Skip to content

Commit 318114d

Browse files
DavertMikclaude
andcommitted
fix(graphql): remove ESM-broken require() check so check works (#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. Return null instead, matching REST/ApiDataFactory/Playwright helpers; missing deps already fail at import time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7cb68de commit 318114d

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

lib/helper/GraphQL.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ class GraphQL extends Helper {
5454
}
5555

5656
static _checkRequirements() {
57-
try {
58-
require('axios')
59-
} catch (e) {
60-
return ['axios']
61-
}
57+
// In ESM, axios is already imported at the top, so no need to check
58+
// The import will fail at module load time if axios is missing
59+
return null
6260
}
6361

6462
static _config() {

lib/helper/GraphQLDataFactory.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,9 @@ class GraphQLDataFactory extends Helper {
175175
}
176176

177177
static _checkRequirements() {
178-
try {
179-
require('axios')
180-
require('rosie')
181-
} catch (e) {
182-
return ['axios', 'rosie']
183-
}
178+
// In ESM, dependencies are already imported at the top
179+
// The import will fail at module load time if dependencies are missing
180+
return null
184181
}
185182

186183
_after() {

0 commit comments

Comments
 (0)