-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Native node TestContext.assert is not typed correctly #59787
Comments
This is working as intended per #32695. Assertions require every name in the call target to be declared with an explicit type annotation. |
I've got three questions.
I appreciate any extra detail or dumbing-down of the information that you can provide. |
|
This issue has been marked as "Question" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
I don't think this is a TypeScript issue per se, but it is weird that this works when |
🔎 Search Terms
NodeJS 22
Typescript 5.5.4
test runner
assertions
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/PTAEAsBdIBwZwFwgHYHsAmBTAVnAdKgE4Dmw6qAxnMADYCGkmckwdMAlsI83lALY0AxBVTJGAD0h04cTIUgAodnxhFIoAN6hu6gL6gAZoVR9QAcjRYEOswG4FCkKABCxgNaZkCnQAozNgBpQH0gASlAAXgA+TQVQbTxpWXk8ZkJ2CkgAUQBHAFc6GhDCPMwgyBLMUPtdaodlVXlNUAAVJkgAYVEJPUNjUwsMTGt2uwcnAHUiN3ZkYm92v0DgyARW9q6xTElw6Nj4yESZOUO0jOz8wuLS8sq62tsgA
💻 Code
🙁 Actual behavior
Assertions require every name in the call target to be declared with an explicit type annotation.(2775)
input.tsx(5, 15): 't' needs an explicit type annotation.
(property) TestContextAssert.strictEqual: (actual: unknown, expected: true, message?: string | Error) => asserts actual is true
Tests strict equality between the actual and expected parameters as determined by Object.is().
import assert from 'node:assert/strict';
assert.strictEqual(1, 2);
// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
//
// 1 !== 2
🙂 Expected behavior
// Both cases should be treated the same way.
test('test', (t) => {
t.assert.strictEqual(true, true);
});
test('test', (t: TestContext) => {
t.assert.strictEqual(true, true);
});
Additional information about the issue
Test example taken directly from NodeJS 22 documentation
https://nodejs.org/api/test.html#contextassert
The text was updated successfully, but these errors were encountered: