Files
Richard Solar 2fad6be617 refactor: move describe helper to @crawlee/utils as inspectValue (#3586)
# Summary
   
Extracts the ad-hoc `describe()` helper that was inlined inside
`ServiceConflictError` into a shared, reusable utility exported from
`@crawlee/utils` as `inspectValue`.
- **New util** `packages/utils/src/internals/debug.ts` →
`inspectValue(value)`:
returns `value.constructor.name` when available, otherwise falls back to
`util.inspect` with sensible defaults (`depth: 0`, `compact: true`,
`maxStringLength: 64`, no colors). This
correctly handles `null`/`undefined` and other cases where the previous
helper would have returned `"null"`/`"undefined"` via `String()` —
acceptable, but now uniform with how we label other
values.
- **Rename** from `describe` to `inspectValue` — `describe`
- **`ServiceConflictError`** now delegates to `inspectValue` instead of
carrying its own inline implementation.
- **Test setup:** switched `test/vitest.setup.ts` to import
`serviceLocator` dynamically inside `beforeEach` to avoid the eager
import ordering issue surfaced by the change.
  Closes #3497
2026-08-18 17:48:44 +02:00

7 lines
183 B
TypeScript

import { beforeEach } from 'vitest';
beforeEach(async () => {
const { serviceLocator } = await import('../packages/core/src/service_locator.js');
serviceLocator.reset();
});