Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Node.js assert.deepStrictEqual uses structural equality (passes for different object instances). Tripwire's deepStrictEqual requires exact instance identity. This breaks tests migrating from Node.js that compare factory-generated objects.

Changes

Migration Guide

  • Created docs/migration/migrating-from-node-assert.md (622 lines)
    • Documents deepStrictEqual instance vs structural equality difference
    • Provides migration strategy: use deepEqual for object comparisons
    • Includes API compatibility table, migration patterns, and Copilot prompts
    • Covers common patterns: Object.assign, spread operator, factory functions, JSON operations

Documentation Links

  • Added migration guide references to README.md, docs/README.md, core/README.md

Example

// Node.js - passes with structural equality
const result = Object.assign({}, { a: 1 });
assert.deepStrictEqual(result, { a: 1 }); // ✅

// Tripwire - fails, requires same instance
assert.deepStrictEqual(result, { a: 1 }); // ❌
assert.deepEqual(result, { a: 1 });        // ✅ Use this instead
Original prompt

This section details on the original issue you should resolve

<issue_title>[Issue] tripwire's deepStrictEqual has stricter instance checking than Node's assert</issue_title>
<issue_description>Details:

  • Node's assert.deepStrictEqual passes when comparing structurally identical objects created via objAssign({}, ...)
  • Tripwire's assert.deepStrictEqual fails on the same comparisons, requiring exact instance identity
  • This affects tests for functions like deepMerge and mergeOptions that return new object instances

Example:

// This passes with Node's assert but fails with tripwire
const result = objAssign({}, { a: 1 });
assert.deepStrictEqual(result, { a: 1 }); // Fails: different instances

Workaround: Use deepEqual instead of deepStrictEqual for new object instances.</issue_description>

<agent_instructions>Add a migration guide to the docs/migration folder for migrating from node native assertions to tripwire and include relevant links to it</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 10, 2026 16:54
Co-authored-by: nev21 <82737406+nev21@users.noreply.github.com>
Co-authored-by: nev21 <82737406+nev21@users.noreply.github.com>
Copilot AI changed the title [WIP] Add migration guide for tripwire deepStrictEqual Add Node.js assert migration guide documenting deepStrictEqual behavioral difference Feb 10, 2026
Copilot AI requested a review from nev21 February 10, 2026 16:57
@nev21 nev21 marked this pull request as ready for review February 10, 2026 17:06
@nev21 nev21 requested a review from a team as a code owner February 10, 2026 17:06
Copilot AI review requested due to automatic review settings February 10, 2026 17:06
@nev21 nev21 requested a review from a team as a code owner February 10, 2026 17:06
@nev21 nev21 enabled auto-merge (squash) February 10, 2026 17:06
@nev21 nev21 disabled auto-merge February 10, 2026 17:06
@nev21
Copy link
Contributor

nev21 commented Feb 10, 2026

@copilot create 2 new issues detailing the missing node assertion functions and workarounds so they can be scheduled to be implemented, separate the synchronous and asynchronous (Promise) assertions into different issues

Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

@copilot create 2 new issues detailing the missing node assertion functions and workarounds so they can be scheduled to be implemented, separate the synchronous and asynchronous (Promise) assertions i...

I don't have permissions to create GitHub issues directly. However, I've prepared the issue details below that you can use to create them:


Issue 1: Add synchronous string matching assertions

Title: [Feature Request] Implement assert.match() and assert.doesNotMatch()

Description:

## Feature Request

Add synchronous string matching assertions to match Node.js assert API.

### Missing Functions

- `assert.match(string, regexp, message?)` - Expects the string input to match the regular expression
- `assert.doesNotMatch(string, regexp, message?)` - Expects the string input to NOT match the regular expression

### Current Workarounds

```js
// Instead of assert.match()
expect(string).to.match(regexp);

// Instead of assert.doesNotMatch()
expect(string).to.not.match(regexp);

Node.js Documentation

Related

See migration guide: Migrating from Node.js Assert


---

**Issue 2: Add async/Promise assertion functions**

Title: `[Feature Request] Implement assert.rejects() and assert.doesNotReject()`

Description:
```markdown
## Feature Request

Add async/Promise assertion functions to match Node.js assert API.

### Missing Functions

- `assert.rejects(asyncFn, error?, message?)` - Awaits the asyncFn promise or, if asyncFn is a function, calls the function and awaits the returned promise. It will then check that the promise is rejected.
- `assert.doesNotReject(asyncFn, error?, message?)` - Awaits the asyncFn promise or, if asyncFn is a function, calls the function and awaits the returned promise. It will then check that the promise is not rejected.

### Current Workarounds

```js
// Instead of assert.rejects()
await assert.throws(async () => await asyncFn());

// Instead of assert.doesNotReject()
await assert.doesNotThrow(async () => await asyncFn());

Node.js Documentation

Related

See migration guide: Migrating from Node.js Assert

Copilot AI requested a review from nev21 February 10, 2026 17:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new migration guide to help users moving from Node.js’s built-in assert module to Tripwire, with emphasis on behavioral differences (notably deepStrictEqual) and links surfaced from existing READMEs.

Changes:

  • Added a new documentation page: docs/migration/migrating-from-node-assert.md
  • Linked the new migration guide from README.md, docs/README.md, and core/README.md

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
docs/migration/migrating-from-node-assert.md New migration guide describing Node assert → Tripwire migration patterns and API differences
docs/README.md Adds a “Migration Guides” section linking to the new Node assert migration guide
core/README.md Adds documentation links for expression adapter + migration guides
README.md Updates top-level docs section to include explicit migration guide links

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.43%. Comparing base (b1891ef) to head (a3a98a9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #270   +/-   ##
=======================================
  Coverage   91.43%   91.43%           
=======================================
  Files          78       78           
  Lines        3445     3445           
  Branches      887      887           
=======================================
  Hits         3150     3150           
  Misses        295      295           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

nevware21-bot
nevware21-bot previously approved these changes Feb 10, 2026
Copy link
Contributor

@nevware21-bot nevware21-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by nevware21-bot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
nev21 and others added 2 commits February 11, 2026 09:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nev21 nev21 enabled auto-merge (squash) February 12, 2026 01:26
Copy link
Contributor

@nev21 nev21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@nevware21-bot nevware21-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by nevware21-bot

@nev21 nev21 merged commit 808339a into main Feb 12, 2026
11 checks passed
@nev21 nev21 deleted the copilot/update-migration-guide-tripwire branch February 12, 2026 02:30
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.

[Issue] tripwire's deepStrictEqual has stricter instance checking than Node's assert

3 participants