n8n/packages/workflow/test/errors/execution-base.error.test.ts
José Braulio González Valido fffa4233b3
Some checks failed
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Has been cancelled
CI: Master (Build, Test, Lint) / Unit tests (22.22.3) (push) Has been cancelled
CI: Master (Build, Test, Lint) / Unit tests (24.16.0) (push) Has been cancelled
CI: Master (Build, Test, Lint) / Lint (push) Has been cancelled
CI: Master (Build, Test, Lint) / Performance (push) Has been cancelled
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Util: Update Node Popularity / approve-and-automerge (push) Has been cancelled
fix(core): Construct execution errors correctly when Error.prototype is frozen (#33897)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 17:34:50 +00:00

29 lines
898 B
TypeScript

import { ExpressionError } from '../../src/errors';
describe('ExecutionBaseError', () => {
it('should set name to the concrete class name', () => {
const error = new ExpressionError('message');
expect(error.name).toBe('ExpressionError');
});
describe('with a frozen Error.prototype', () => {
const nameDescriptor = Object.getOwnPropertyDescriptor(Error.prototype, 'name')!;
beforeAll(() => {
Object.defineProperty(Error.prototype, 'name', { ...nameDescriptor, writable: false });
});
afterAll(() => {
Object.defineProperty(Error.prototype, 'name', nameDescriptor);
});
it('should construct and set name without writing through the prototype', () => {
const error = new ExpressionError('Paired item data is unavailable');
expect(error.name).toBe('ExpressionError');
expect(Object.getOwnPropertyDescriptor(error, 'name')?.writable).toBe(true);
});
});
});