Skip to content

chore(all): npm libraries bump and breaking changes fixes #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ jobs:
- name: Collate Coverage Reports
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
mkdir -p coverage
for d in ./packages/*/ ; do
mkdir -p coverage
if [[ ! -f coverage/lcov.info ]]
then
continue
fi
filename="$d""coverage/lcov.info"
targetSource="SF:""$d""src"
sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info
Expand Down
3,156 changes: 1,418 additions & 1,738 deletions npm-shrinkwrap.json

Large diffs are not rendered by default.

1,053 changes: 534 additions & 519 deletions packages/logger/npm-shrinkwrap.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/logger/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ class Logger implements ClassThatLogs {
if (typeof input !== 'string') {
logItem.addAttributes(input);
}
extraInput.forEach((item: Error | LogAttributes) => {
extraInput.forEach((item: Error | LogAttributes | unknown) => {
const attributes = (item instanceof Error) ? { error: item } : item;
logItem.addAttributes(attributes);
logItem.addAttributes(<LogAttributes>attributes);
});

return logItem;
Expand Down
18 changes: 12 additions & 6 deletions packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedError = formatter.formatError(error);
expect(error).toBeInstanceOf(Error);
const formattedError = formatter.formatError(<Error>error);
expect(formattedError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+$/),
message: 'Ouch!',
Expand All @@ -136,7 +137,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedReferenceError = formatter.formatError(error);
expect(error).toBeInstanceOf(Error);
const formattedReferenceError = formatter.formatError(<Error>error);
expect(formattedReferenceError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+$/),
message: 'doesNotExist is not defined',
Expand Down Expand Up @@ -164,7 +166,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedAssertionError = formatter.formatError(error);
expect(error).toBeInstanceOf(AssertionError);
const formattedAssertionError = formatter.formatError(<AssertionError>error);
expect(formattedAssertionError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+/),
message: expect.stringMatching(/Expected values to be strictly equal/),
Expand Down Expand Up @@ -192,7 +195,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedRangeError = formatter.formatError(error);
expect(error).toBeInstanceOf(RangeError);
const formattedRangeError = formatter.formatError(<RangeError>error);
expect(formattedRangeError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+/),
message: 'The argument must be between 10 and 20',
Expand All @@ -219,7 +223,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedSyntaxError = formatter.formatError(error);
expect(error).toBeInstanceOf(SyntaxError);
const formattedSyntaxError = formatter.formatError(<SyntaxError>error);
expect(formattedSyntaxError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+/),
message: 'Unexpected identifier',
Expand Down Expand Up @@ -247,7 +252,8 @@ describe('Class: PowertoolLogFormatter', () => {
shouldThrow();
} catch (error) {
// Assess
const formattedTypeError = formatter.formatError(error);
expect(error).toBeInstanceOf(Error);
const formattedTypeError = formatter.formatError(<Error>error);
expect(formattedTypeError).toEqual({
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+/),
message: 'Cannot read property \'foo\' of null',
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/types/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type UnformattedAttributes = {
};

type LogItemMessage = string | LogAttributesWithMessage;
type LogItemExtraInput = Array<Error | LogAttributes>;
type LogItemExtraInput = Array<Error | LogAttributes | unknown>;

type HandlerMethodDecorator = (target: LambdaInterface, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<Handler>) => TypedPropertyDescriptor<Handler> | void;

Expand Down
Loading