feat(core): error.factory - display full stacktrace
MODIFY
packages/core/src/effects/specs/effects.factory.spec.ts
packages/core/src/effects/specs/effects.factory.spec.ts
@@ -49,7 +49,7 @@ describe('EffectFactory', () => {
expect(effectFactoryFn).toThrowError(expectedError);
});
- test('throws an error if "mathod" is not provided', () => {
+ test('throws an error if "method" is not provided', () => {
// given
expectedError = new Error('HttpMethod needs to be defined');
@@ -62,7 +62,7 @@ describe('EffectFactory', () => {
expect(effectFactoryFn).toThrowError(expectedError);
});
- test('throws an error if provided "mathod" is not included in the list', () => {
+ test('throws an error if provided "method" is not included in the list', () => {
// given
expectedError = new Error(
'HttpMethod needs to be one of the following: POST,PUT,PATCH,GET,HEAD,DELETE,CONNECT,OPTIONS,TRACE,*'

MODIFY
packages/core/src/error/specs/error.factory.spec.ts
packages/core/src/error/specs/error.factory.spec.ts
-import { CoreErrorOptions, coreErrorFactory, coreErrorStackTraceFactory } from '../error.factory';
+import { CoreErrorOptions, coreErrorFactory, coreErrorStackTraceFactory, stringifyStackTrace } from '../error.factory';
const getMockedStackTrace = (opts: any = {}) => [
{ getMethodName: jest.fn(() => opts.methodName) },
@@ -11,6 +11,23 @@ const getMockedStackTrace = (opts: any = {}) => [
describe('Error factory', () => {
+ describe('#stringifyStackTrace', () => {
+ test('stringifies stack trace', () => {
+ // given
+ const stackTrace = ['1', '2', '3'] as any as NodeJS.CallSite[];
+
+ // when
+ // jest.spyOn(chalk, 'gray');
+ const stringifiedStackTrace = stringifyStackTrace(stackTrace);
+
+ // then
+ expect(stringifiedStackTrace).toBeDefined();
+ expect(stringifiedStackTrace).toContain('@ 1');
+ expect(stringifiedStackTrace).toContain('@ 2');
+ expect(stringifiedStackTrace).toContain('@ 3');
+ });
+ });
+
describe('#coreErrorStackTraceFactory', () => {
test('factorizes stack trace', () => {
// given

feat(core): error.factory - display full stacktrace