-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(chai-shim): Enable ownInclude, deepOwnInclude, and Map/Set keys assertions #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR expands the Chai compatibility shim and core assertion engine to support ownInclude / deepOwnInclude (and their negations), improves include/keys error messaging, and enables/extends Map/Set-related assertions and formatting.
Changes:
- Enable Chai-shim
ownInclude,deepOwnInclude(and negations) and add coverage for include/keys with Map/Set. - Improve error message templating (new
{typeof(x)}/{len(x)}token ops) and standardize quoting/formatting of keys/collections. - Add Map/Set formatting in assertion messages and introduce additional assertion APIs (
doesNotThrow,notMatch, keys helpers).
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| shim/chai/test/src/chaiAssert.test.ts | Uncomments/enables include/deepInclude/ownInclude/keys tests and updates expected messages/formatting. |
| shim/chai/src/assert/chaiAssert.ts | Enables ownInclude/deepOwnInclude adapters (previously unimplemented). |
| shim/chai/README.md | Documents newly supported collection assertions in the shim. |
| core/test/src/operations/keysOp.test.ts | Updates expected keys error messages (string quoting). |
| core/test/src/operations/includeOp.test.ts | Updates null/undefined includeOp error messages to new “unsupported collection type” format. |
| core/test/src/operations/deepIncludeOp.test.ts | Updates deep include messages and null/undefined handling expectations. |
| core/test/src/assert/members.test.ts | Adds additional negative-assertion test coverage for member-related assertions. |
| core/test/src/assert/funcs/anyValuesFunc.test.ts | Updates expected any-values error formatting (quoting / token formatting). |
| core/test/src/assert/funcs/allValuesFunc.test.ts | Updates expected all-values error formatting and test strings. |
| core/test/src/assert/expect.to.test.ts | Updates keys error message quoting in expect-style tests. |
| core/test/src/assert/expect.ownInclude.test.ts | Adds expect-style tests for ownInclude/deepOwnInclude and negations. |
| core/test/src/assert/expect.isIterable.ts | Updates string fixtures and related expected error messages. |
| core/test/src/assert/expect.include.test.ts | Adds object property matching tests for include/deep.include and updates keys error messages. |
| core/test/src/assert/expect.has.test.ts | Updates keys error message quoting in expect-style tests. |
| core/test/src/assert/assert.ownInclude.test.ts | Adds assert-style tests for ownInclude/deepOwnInclude and negations. |
| core/test/src/assert/assert.ok.test.ts | Updates Map/Set formatting expectations in truthiness error messages. |
| core/test/src/assert/assert.notMatch.test.ts | Adds tests for new assert.notMatch. |
| core/test/src/assert/assert.isObject.test.ts | Updates Map formatting expectation in isObject-related error message. |
| core/test/src/assert/assert.isIterable.test.ts | Updates Map/Set formatting expectation in iterable-related error messages. |
| core/test/src/assert/assert.includes.test.ts | Adds include tests for Error property matching and Map/Set include semantics. |
| core/test/src/assert/assert.ifError.test.ts | Adds a missing assertion inside a non-throwing block. |
| core/test/src/assert/assert.hasAnyKeys.test.ts | Adds tests for new assert.hasAnyKeys. |
| core/test/src/assert/assert.hasAllKeys.test.ts | Adds tests for new assert.hasAllKeys. |
| core/test/src/assert/assert.doesNotThrow.test.ts | Adds tests for new assert.doesNotThrow. |
| core/test/src/assert/assert.doesNotHaveAnyKeys.test.ts | Adds tests for new assert.doesNotHaveAnyKeys. |
| core/test/src/assert/assert.doesNotHaveAllKeys.test.ts | Adds tests for new assert.doesNotHaveAllKeys. |
| core/src/assert/scopeContext.ts | Adds {typeof(...)} / {len(...)} token ops and introduces context.fatal() with AssertionFatal. |
| core/src/assert/ops/ownOp.ts | Routes .own.include / .deep.own.include to new include ops. |
| core/src/assert/ops/numericOp.ts | Converts type-validation failures to fatal() (non-negatable). |
| core/src/assert/ops/includeOp.ts | Adds Map/Set include semantics, object property matching, ownInclude/deepOwnInclude operations, and improved unsupported-type errors. |
| core/src/assert/ops/changeResultOp.ts | Converts argument validation failures to fatal(). |
| core/src/assert/internal/_formatValue.ts | Adds Set/Map formatters to show contents in messages. |
| core/src/assert/internal/_addAssertInstFuncs.ts | Avoids template literals for ES5 compatibility. |
| core/src/assert/interface/ops/IToOp.ts | Updates doc examples text (string fixture changes). |
| core/src/assert/interface/IScopeContext.ts | Adds fatal() API docs to scope context interface. |
| core/src/assert/interface/IFormatter.ts | Updates copyright and adds deprecated-note doc (contains a typo). |
| core/src/assert/interface/IAssertInst.ts | Updates doc examples text (string fixture changes). |
| core/src/assert/interface/IAssertClass.ts | Adds/extends public APIs: doesNotThrow, notMatch, ownInclude/deepOwnInclude, and keys helpers. |
| core/src/assert/funcs/valuesFunc.ts | Switches value list formatting to token-based formatting via context details. |
| core/src/assert/funcs/operator.ts | Converts invalid-operator failure to fatal(). |
| core/src/assert/funcs/oneOf.ts | Converts list-argument validation failure to fatal(). |
| core/src/assert/funcs/nested.ts | Converts nested-path validation failure to fatal(). |
| core/src/assert/funcs/members.ts | Converts input validation failures to fatal(). |
| core/src/assert/funcs/match.ts | Converts non-regexp match argument failure to fatal(). |
| core/src/assert/funcs/keysFunc.ts | Switches key list formatting to token-based formatting and adjusts required-keys errors. |
| core/src/assert/funcs/isEmpty.ts | Converts unsupported-type failures to fatal(). |
| core/src/assert/funcs/instanceOf.ts | Converts non-function constructor failure to fatal(). |
| core/src/assert/funcs/hasProperty.ts | Converts invalid property name type failures to fatal(). |
| core/src/assert/funcs/equal.ts | Converts circular-reference hard failure to fatal(). |
| core/src/assert/funcs/closeTo.ts | Converts numeric argument validation failures to fatal(). |
| core/src/assert/funcs/changes.ts | Converts missing-property failure to fatal(). |
| core/src/assert/assertClass.ts | Exposes new assertion methods via expression adapters (doesNotThrow, notMatch, ownInclude, keys helpers). |
| core/src/assert/adapters/exprAdapter.ts | Avoids template literals for ES5 compatibility and improves step-error message formatting. |
9b396d4 to
5f035fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 7 comments.
…assertions Add support for ownInclude, notOwnInclude, deepOwnInclude, and notDeepOwnInclude assertions to the Chai compatibility shim. Changes: - Implement own.include operation for checking own properties only - Add deep.own.include for deep equality comparison of own properties - Enable previously commented tests for include, deepInclude, keys operations with Map/Set collections - Improve error messages for include operations on unsupported types - Update keys operation error messages to quote string keys consistently - Fix Map/Set formatting in error messages to show contents Core changes: - Update includeOp error messages for null/undefined to be more descriptive - Update keysOp error messages to wrap string keys in quotes Error Message Improvements - Updated includeOp.test.ts error messages for null/undefined to use descriptive format: "argument null (\"null\") is not a supported collection type" Copyright Updates - Updated copyright years to 2024-2026 for modified files
5f035fc to
03cdbf2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
Add support for ownInclude, notOwnInclude, deepOwnInclude, and notDeepOwnInclude assertions to the Chai compatibility shim.
Changes:
Core changes:
Error Message Improvements
Copyright Updates