Skip to content

Add assertion-error to allowed dependencies#1206

Merged
jakebailey merged 1 commit into
microsoft:mainfrom
MysteryBlokHed:allow-packages/assertion-error
Oct 4, 2025
Merged

Add assertion-error to allowed dependencies#1206
jakebailey merged 1 commit into
microsoft:mainfrom
MysteryBlokHed:allow-packages/assertion-error

Conversation

@MysteryBlokHed
Copy link
Copy Markdown
Contributor

Related PR: DefinitelyTyped/DefinitelyTyped#73830

The chai package uses and re-exports the AssertionError class from this package.

@jakebailey
Copy link
Copy Markdown
Member

What version of chai does this? I checked latest and it doesn't list it as a dep, but maybe I missed something.

@MysteryBlokHed
Copy link
Copy Markdown
Contributor Author

What version of chai does this? I checked latest and it doesn't list it as a dep, but maybe I missed something.

This affects at least the v5 branch. The package.json defines it as a dependency here: https://github.com/chaijs/chai/blob/5.x.x/package.json#L54

And I think that the re-export happens here: https://github.com/chaijs/chai/blob/445243d5e769c6b155e2a35e25a5f747afd2da88/lib/chai.js#L8-L19

In any case, I do seem to be able to access the AssertionError export (tested with v5.3.3):

// package.json
{
  "private": true,
  "type": "module",
  "name": "example",
  "version": "0.0.1",
  "dependencies": {
    "chai": "^5"
  }
}
// index.js
import { AssertionError } from "chai";
console.log(AssertionError);
$ node index.js
[class AssertionError extends Error]

@jakebailey
Copy link
Copy Markdown
Member

Only in npm and older yarn, since they hoist. Anyway, thanks for explaining.

@jakebailey jakebailey added this pull request to the merge queue Oct 4, 2025
Merged via the queue into microsoft:main with commit 06c2232 Oct 4, 2025
9 checks passed
@MysteryBlokHed MysteryBlokHed deleted the allow-packages/assertion-error branch October 4, 2025 04:34
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.

2 participants