Skip to content

Commit

Permalink
Fix telemetry reporting for integrations that return an array (#7429)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Jun 20, 2023
1 parent 82b1964 commit 89a4835
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/witty-roses-relate.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix telemetry reporting for integrations that return an array
5 changes: 4 additions & 1 deletion packages/astro/src/events/session.ts
Expand Up @@ -83,7 +83,10 @@ export function eventCliSession(
) ?? []),
] as string[],
adapter: userConfig?.adapter?.name ?? null,
integrations: (userConfig?.integrations ?? []).filter(Boolean).map((i: any) => i?.name),
integrations: (userConfig?.integrations ?? [])
.filter(Boolean)
.flat()
.map((i: any) => i?.name),
trailingSlash: userConfig?.trailingSlash,
build: userConfig?.build
? {
Expand Down
8 changes: 8 additions & 0 deletions packages/astro/test/events.test.js
Expand Up @@ -385,6 +385,14 @@ describe('Events', () => {
expect(payload.config.integrations.length).to.equal(0);
});

it('finds names for integration arrays', () => {
const config = {
integrations: [{ name: 'foo' }, [{ name: 'bar' }, { name: 'baz' }]],
};
const [{ payload }] = events.eventCliSession({ cliCommand: 'dev' }, config);
expect(payload.config.integrations).to.deep.equal(['foo', 'bar', 'baz']);
});

it('includes cli flags in payload', () => {
const config = {};
const flags = {
Expand Down

0 comments on commit 89a4835

Please sign in to comment.