Skip to content

Commit

Permalink
support empty changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev committed Jun 20, 2024
1 parent 63e60b5 commit fe4fafc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scripts/__tests__/changeset-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ describe('Changeset Client', () => {
expect.assertions(2);

const expectedParsedChangesets = [
{
packages: [],
summary: '',
},
{
packages: [
'@aws-amplify/data-schema-types',
Expand All @@ -67,7 +71,7 @@ describe('Changeset Client', () => {

const result = await changesetClient.deleteAll();

expect(rm).toHaveBeenCalledTimes(2);
expect(rm).toHaveBeenCalledTimes(3);
expect(result).toEqual(expectedParsedChangesets);
});
});
Expand Down
2 changes: 2 additions & 0 deletions scripts/__tests__/fixtures/.changeset/empty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
6 changes: 4 additions & 2 deletions scripts/components/changeset-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export class ChangesetClient {
.filter(Boolean);

const packages = header
.split('\n')
.map((line) => line.split(':')[0].trim().replace(/['"]/g, ''));
? header
.split('\n')
.map((line) => line.split(':')[0].trim().replace(/['"]/g, ''))
: [];

const summary = summaryLines.join(' ').trim();

Expand Down

0 comments on commit fe4fafc

Please sign in to comment.