Title: test_runner: support custom message for expectFailure by Han5991 · Pull Request #61563 · nodejs/node · GitHub
Open Graph Title: test_runner: support custom message for expectFailure by Han5991 · Pull Request #61563 · nodejs/node
X Title: test_runner: support custom message for expectFailure by Han5991 · Pull Request #61563 · nodejs/node
Description: Summary This PR enhances the expectFailure option in the test runner to accept different types of values, enabling both custom failure labels and robust error validation. This implementation is referenced from and inspired by nodejs/test-runner#10. Changes The expectFailure option now supports the following types: String: Treated as a failure label (reason). test('bug', { expectFailure: 'Investigating' }, ...); RegExp / Function / Error Class: Treated as a matcher to validate the thrown error (similar to assert.throws). test('regex', { expectFailure: /error message/ }, ...); test('class', { expectFailure: RangeError }, ...); Object: If it contains label or match properties, it's treated as a configuration object. test('config', { expectFailure: { label: 'Known issue', match: /specific error/ } }, ...); Otherwise, it's treated as an object matcher (properties matching). Inheritance: Tests now inherit expectFailure from their parent suite. This allows marking an entire suite as expected to fail. test('suite', { expectFailure: true }, async (t) => { await t.test('subtest', () => { throw new Error(); }); // Passes (expected failure) }); References Based on concepts from: nodejs/test-runner#10 Resolves: #61570
Open Graph Description: Summary This PR enhances the expectFailure option in the test runner to accept different types of values, enabling both custom failure labels and robust error validation. This implementation is ref...
X Description: Summary This PR enhances the expectFailure option in the test runner to accept different types of values, enabling both custom failure labels and robust error validation. This implementation is ref...
Opengraph URL: https://github.com/nodejs/node/pull/61563
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5f97f752-e38a-5d94-7477-23e853521c07 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8994:4F057:23D230:2FE10D:6A4C2650 |
| html-safe-nonce | 066099880cbe1d1cfba41a365bfcfd99ae0087557a54a687ec329ccdb42ed950 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTk0OjRGMDU3OjIzRDIzMDoyRkUxMEQ6NkE0QzI2NTAiLCJ2aXNpdG9yX2lkIjoiNjU1NTc5NTEyODQyOTg0ODE0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c5e12c0bf1b53ed6a644f750f733eb83190d02d73a1ad38ec365f6d7fd168f40 |
| hovercard-subject-tag | pull_request:3219151169 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodejs/node/pull/61563/files |
| twitter:image | https://avatars.githubusercontent.com/u/73056306?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/73056306?s=400&v=4 |
| og:image:alt | Summary This PR enhances the expectFailure option in the test runner to accept different types of values, enabling both custom failure labels and robust error validation. This implementation is ref... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1b6b16d04026f131a36d57e3b01d0f4d26a51800edf48bf5ed0256e0ac905511 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ee13484b32cf23e15fde191da4c9aa47d41201c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width