Fix failing tests due to failed error logging

Unit and integration tests have been failing due to failed logging of
`Error` objects. These were creating an issue where `mocha` was not
properly returning right exit codes, leading to test pipelines
incorrectly passing despite test failures.

- Fix runtime behavior of failing to retrieve error stacks.
- Add tests for error handling.
- Add more robust custom error handling.

Related issues: babel/babel#14273, vuejs/vue-cli#6994.
This commit is contained in:
undergroundwires
2023-08-10 19:49:08 +02:00
parent 061afad967
commit 986ba078a6
5 changed files with 232 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ import { expect } from 'chai';
import { INodeDataErrorContext, NodeDataError } from '@/application/Parser/NodeValidation/NodeDataError';
import { NodeDataErrorContextStub } from '@tests/unit/shared/Stubs/NodeDataErrorContextStub';
import { NodeType } from '@/application/Parser/NodeValidation/NodeType';
import { CustomError } from '@/application/Common/CustomError';
describe('NodeDataError', () => {
it('sets message as expected', () => {
@@ -28,20 +29,13 @@ describe('NodeDataError', () => {
// assert
expect(sut.context).to.equal(expected);
});
it('sets stack as expected', () => {
it('extends CustomError', () => {
// arrange
const expected = CustomError;
// act
const sut = new NodeDataErrorBuilder()
.build();
// assert
expect(sut.stack !== undefined);
});
it('extends Error', () => {
// arrange
const expected = Error;
// act
const sut = new NodeDataErrorBuilder().build();
// assert
expect(sut).to.be.an.instanceof(expected);
});
});