Skip to content

PackageAssertion

Defined in: packages/engine/src/testing/index.ts:477

Assertions about a package’s declared descriptor, returned by expectPackage. These catch the three mistakes the issue calls out, before the package is ever registered. Every matcher returns this and throws an ExpectationError when it fails.

new PackageAssertion(pkg): PackageAssertion;

Defined in: packages/engine/src/testing/index.ts:478

ParameterType
pkgIEnginePackage

PackageAssertion

notToCollideWith(others, strictness?): CompatibilityReport;

Defined in: packages/engine/src/testing/index.ts:520

Assert the package does not collide with any of others in a way that would silently break one of them (two packages claiming the same lexer keyword, plugin-function index, async-resolver namespace, and so on).

strictness sets which severities fail the assertion: "error" (the default) fails only on the collisions that always break something, "warning" also fails on the ones that silently pick a winner, "info" fails on cosmetic overlaps too.

ParameterTypeDefault value
othersIEnginePackage[]undefined
strictnessCollisionStrictness"error"

CompatibilityReport

the full compatibility report, so a test can inspect every conflict, including ones below the strictness threshold.


notToShadow(words?): ShadowedWord[];

Defined in: packages/engine/src/testing/index.ts:492

Assert none of the package’s claimed words shadow a prose word.

A trigger word that is also an ordinary word turns a line of prose into arithmetic, the single most common package mistake and the subject of the trigger-words guide. This checks the words the package declares (lexer keywords, units, operators, and single-word phrases) against words (defaulting to COMMON_PROSE_WORDS), case-insensitively.

ParameterTypeDefault value
wordsreadonly string[]COMMON_PROSE_WORDS

ShadowedWord[]

the shadowed words, empty when the package is clean, for a test that wants to inspect rather than assert.


toDeclareCompatibleEngineVersion(engineVersion?): this;

Defined in: packages/engine/src/testing/index.ts:551

Assert the package’s declared engineVersion range is satisfied by the running engine (or by engineVersion when given).

A package that declares a range and never checks it resolves is the third mistake the issue names: it looks fine until the one engine version it cannot run against, where the range either fails to match or turns out to be a malformed string. A package with no declared range passes (no constraint is always compatible).

ParameterTypeDefault value
engineVersionstringENGINE_VERSION

this