When a project uses pnpm catalogs, ember-cli in package.json may have a value like "catalog:tools" rather than a semver string. validateLoadBalance reads this value directly and passes it to semver.validRange(), which returns null for non-semver strings. The subsequent semver.gtr('3.2.0', null) call then throws:
TypeError: Cannot read properties of null (reading 'trim')
at new Range (semver/classes/range.js:36:22)
at outside (semver/ranges/outside.js:15:11)
at Object.gtr (semver/ranges/gtr.js:5:42)
at TestsOptionsValidator.validateLoadBalance (ember-exam/lib/utils/tests-options-validator.js:296:16)
Root cause (commands/exam.js:112):
this.emberCliVersion =
this.project.pkg.devDependencies['ember-cli'] ||
this.project.pkg.dependencies['ember-cli'];
This gives "catalog:tools" instead of a resolved version.
Suggested fix: Guard against non-semver strings before calling semver.validRange:
const rawVersion = this.project.pkg.devDependencies['ember-cli'] ||
this.project.pkg.dependencies['ember-cli'];
// Catalog refs (e.g. "catalog:tools") are not semver — skip the check
this.emberCliVersion = semver.validRange(rawVersion) ? rawVersion : null;
Then in validateLoadBalance, treat a null version as "unknown / assumed sufficient" and skip the check rather than crashing. (The version being checked is 3.2.0 — any modern ember-cli satisfies this unconditionally.)
Workaround: Keep ember-cli pinned with an explicit version string in package.json rather than using a catalog ref.
ember-exam version: 10.1.0
Issue written by Claude (claude-sonnet-4-6), approved by Peter Wagenet.
When a project uses pnpm catalogs,
ember-cliinpackage.jsonmay have a value like"catalog:tools"rather than a semver string.validateLoadBalancereads this value directly and passes it tosemver.validRange(), which returnsnullfor non-semver strings. The subsequentsemver.gtr('3.2.0', null)call then throws:Root cause (
commands/exam.js:112):This gives
"catalog:tools"instead of a resolved version.Suggested fix: Guard against non-semver strings before calling
semver.validRange:Then in
validateLoadBalance, treat a null version as "unknown / assumed sufficient" and skip the check rather than crashing. (The version being checked is 3.2.0 — any modern ember-cli satisfies this unconditionally.)Workaround: Keep
ember-clipinned with an explicit version string inpackage.jsonrather than using a catalog ref.ember-exam version: 10.1.0
Issue written by Claude (claude-sonnet-4-6), approved by Peter Wagenet.