Commit Graph

123 Commits

Author SHA1 Message Date
github-actions[bot] b97fcb0a93 Version Packages 2026-05-19 18:28:24 +00:00
github-actions[bot] 1cc86bee1c Version Packages (next) 2026-04-21 15:07:43 +00:00
Patrik Oldsberg 8741e5a800 errors: add explicit name property to ServiceUnavailableError
Every CustomErrorBase subclass explicitly sets `name = 'ClassName' as const`
except ServiceUnavailableError, which relied on the constructor fallback that
reads `this.constructor.name`. This is fragile under minification. Added the
explicit name property for consistency and added a serialization round-trip test.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-15 12:20:33 +02:00
github-actions[bot] 93e643d142 Version Packages 2026-04-14 14:57:31 +00:00
Patrik Oldsberg 608c1e5958 Have assertError delegate to isError in @backstage/errors
Simplify the assertError implementation by delegating to isError
instead of duplicating the same validation checks.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-13 13:19:22 +02:00
github-actions[bot] 6c10d88c13 Version Packages (next) 2026-04-07 15:30:58 +00:00
Patrik Oldsberg 482ceed6d2 Address review feedback: simplify toError and add changeset
- Remove JSON.stringify fallback from toError, use the same unknown
  error messaging as stringifyError for all non-string/non-error values
- Add try/catch to protect against values that throw on string
  conversion (e.g. null-prototype objects, symbols)
- Fix no-op `void toError(err)` in DeleteEntityConfirmationDialog
- Fix `${err}` producing [object Object] in UrlReaderProcessor
- Fix double toError call in openStackSwift
- Update JSDoc to accurately describe the behavior
- Add tests for throwing toString and circular objects
- Add changeset for all refactored packages

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-03 11:25:58 +02:00
Patrik Oldsberg b2319ffe45 errors: add toError utility and migrate assertError usages
Add a `toError` utility function to `@backstage/errors` that converts
unknown values to `ErrorLike` objects. If the value is already error-like
it is returned as-is. Strings are used directly as the error message, and
other values are stringified with a fallback to JSON.stringify to avoid
unhelpful `[object Object]` messages.

Non-error causes passed to `CustomErrorBase` are now converted and stored
using `toError` rather than discarded. Existing `assertError` call sites
across the codebase are migrated to `toError`.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-03 10:16:23 +02:00
Johan Persson cd0b8a11a3 chore: make jest a peer dependency with v29/v30 support
Move jest from dependencies to peer dependencies, allowing users to
choose between Jest 29 and Jest 30.

The CLI now detects the Jest version at runtime and uses the
appropriate environment:
- Jest 29: Uses standard jest-environment-jsdom
- Jest 30: Uses a custom environment based on @jest/environment-jsdom-abstract
  with fixes for Web API globals (fetch, streams, Error, etc.)

The cross-fetch polyfill is only injected for Jest 29, as with Jest 30+
our patched Jest environment is used. The network request blocker is made
MSW-compatible by checking if fetch was wrapped before blocking.

Jest 30 (with jsdom v27) fixes `Could not parse CSS stylesheet`
warnings/errors when testing components from @backstage/ui or other
packages using CSS `@layer` declarations.

New peer dependencies (install based on your Jest version):
- jest (required, ^29 or ^30)
- Jest 29 requires: jest-environment-jsdom
- Jest 30 requires: @jest/environment-jsdom-abstract, jsdom

Production code changes for jsdom 27 testability:
- AppIdentityProxy: extract navigateToUrl method for spying
- LiveReloadAddon: export utils.reloadPage for spying
- collect.ts: export internal.resolvePackagePath for mocking

MockFetchApi: evaluate global.fetch at call time instead of construction
time, allowing MSW to patch fetch after MockFetchApi is constructed.

Test adaptations for jsdom 27:
- Use RGB values instead of named colors in CSS assertions
- Update error format expectations (hyphenated type names, SyntaxError
  instead of FetchError for JSON parse errors)
- Simplify URL error assertions for cross-version compatibility
- Fix accessible name whitespace handling for external links
- Use history.replaceState for location mocking (non-configurable)
- Use fireEvent.blur for contentEditable elements
- Move async assertions inside waitFor for race conditions
- Remove Blob.prototype.text polyfill (now native)
- Remove test case using credentials in plugin:// URLs

Test adaptations for Jest 30:
- Replace `expect.objectContaining([...])` with direct array equality
- Replace `expect.objectContaining({ length: N })` with
  `expect.any(Array)` + separate `toHaveLength()` assertions
- Use child process for native Node.js module resolution in
  collect.test.ts to work around Jest 30's resolver behavior
- Update snapshot headers for new Jest format

Also removes the jest-haste-map patch which is no longer needed.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
2025-12-11 18:06:55 +01:00
Patrik Oldsberg 83656f8999 .github/CODEOWNERS: adjust ownership for new project areas
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-05-05 14:19:45 +02:00
github-actions[bot] 43f666371b Version Packages 2025-01-14 12:23:31 +00:00
github-actions[bot] 0980e400a0 Version Packages (next) 2025-01-07 15:04:17 +00:00
github-actions[bot] cfdf107d34 Version Packages 2024-12-17 10:54:05 +00:00
github-actions[bot] 134bc9981f Version Packages (next) 2024-12-10 12:54:09 +00:00
Patrik Oldsberg 1d4b5b9d20 errors: trim error.cause.stack as well
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-12-05 12:47:46 +01:00
github-actions[bot] 1552f03186 Version Packages 2024-11-19 11:21:20 +00:00
blam fc01ce7e77 chore: fix api-reports warnings
Signed-off-by: blam <ben@blam.sh>
2024-10-14 17:56:00 +02:00
secustor c28596309f update files
Signed-off-by: secustor <sebastian@poxhofer.at>
2024-09-23 14:41:40 +02:00
secustor 65da28ad53 add newly generated api reports
Signed-off-by: secustor <sebastian@poxhofer.at>
2024-09-23 14:41:34 +02:00
github-actions[bot] e83e055841 Version Packages 2024-03-19 14:56:10 +00:00
github-actions[bot] 4cca80fbf8 Version Packages (next) 2024-02-27 16:48:30 +00:00
Vincenzo Scamporlino 042622c0de Merge pull request #22645 from backstage/fix/response-error-status-code
Fix ResponseError HTTP status
2024-02-23 23:51:21 +01:00
Fredrik Adelöw c66a99c272 sort package.json files that have no PRs active toward them
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-02-23 13:54:10 +01:00
Vincenzo Scamporlino 406c5675a1 errors: api report
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2024-02-15 13:41:55 +01:00
Vincenzo Scamporlino c9e5b59f78 errors: set statusCode in ResponseError
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2024-02-15 10:47:54 +01:00
Fredrik Adelöw e97cc0b0a3 updated the knip rules a bit
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-02-08 09:53:18 +01:00
Heikki Hellgren 60a68f10e9 ci: introduce knip for checking unused packages
fixes #21948

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
2024-02-08 08:29:48 +02:00
github-actions[bot] 8cdb8c2e40 Version Packages 2023-10-17 08:54:50 +00:00
github-actions[bot] e43d3eb1b7 Version Packages (next) 2023-10-10 11:39:03 +00:00
Fredrik Adelöw 0b55f773a7 Removed some unused dependencies
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2023-10-06 14:32:19 +02:00
github-actions[bot] b228d7d9c2 Version Packages
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-09-20 11:24:40 +02:00
github-actions[bot] a6d1580062 Version Packages (next) 2023-09-12 11:41:29 +00:00
Patrik Oldsberg 406b786a2a fix package side effect declarations
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-09-07 13:40:19 +02:00
Eric Peterson 433b12d921 Marking all plugins >= v1.0.0 as 'production'
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-08-24 17:37:01 +02:00
Eric Peterson f5cdb61269 Add maintainer-owned catalog-info.yaml files
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-08-23 18:02:53 +02:00
github-actions[bot] 0abb3c37b8 Version Packages 2023-07-18 08:35:29 +00:00
github-actions[bot] d72e2eeba6 Version Packages (next) 2023-06-27 12:10:42 +00:00
Fredrik Adelöw 24e91ed76d Merge pull request #17982 from idakucamupeva/error-name-handling
Add name parameter to CustomErrorBase class
2023-06-22 17:03:37 +02:00
Fredrik Adelöw 8b5a6ac778 try to work better with minified code
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2023-06-22 16:28:18 +02:00
github-actions[bot] bc0c4bc64c Version Packages 2023-06-20 13:54:09 +00:00
Mihailo Vlajkovic c27fe32467 Resolve PR discussion
Signed-off-by: Mihailo Vlajkovic <mihailovlajkovic98@gmail.com>
2023-06-19 15:45:03 +02:00
Mihailo Vlajkovic f2865d6aea Shorter class body
Signed-off-by: Mihailo Vlajkovic <mihailovlajkovic98@gmail.com>
2023-06-19 15:45:03 +02:00
Mihailo Vlajkovic a95b7dfa96 Set this.name in all error classes
Signed-off-by: Mihailo Vlajkovic <mihailovlajkovic98@gmail.com>
2023-06-19 15:45:03 +02:00
Mihailo Vlajkovic e205b3e6ed Add name parameter to CustomErrorBase class
Signed-off-by: Mihailo Vlajkovic <mihailovlajkovic98@gmail.com>
2023-06-19 15:45:03 +02:00
github-actions[bot] a8634a9634 Version Packages (next) 2023-05-30 13:52:00 +00:00
Patrik Oldsberg c4e8fefd9f errors: added ServiceUnavailableError
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-05-25 17:31:01 +02:00
github-actions[bot] 24632ad94b Version Packages 2023-03-14 14:31:40 +00:00
github-actions[bot] b19b95fc09 Version Packages (next) 2023-02-28 13:04:36 +00:00
Vincenzo Scamporlino d7ef962073 api reports
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2023-02-17 10:51:02 +01:00
Vincenzo Scamporlino 3bf83a2aab errors: add NotImplementedError
Co-authored-by: Harry Hogg <hhogg@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2023-02-14 17:12:08 +01:00