Skip to content
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

fix(next/build): correct payload for plugin telemetry #38468

Merged
merged 3 commits into from Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/next/telemetry/events/swc-plugins.ts
Expand Up @@ -5,8 +5,8 @@ const EVENT_SWC_PLUGIN_PRESENT = 'NEXT_SWC_PLUGIN_DETECTED'
type SwcPluginsEvent = {
eventName: string
payload: {
packageName: string
packageVersion?: string
pluginName: string
pluginVersion?: string
}
}

Expand Down Expand Up @@ -34,8 +34,8 @@ export async function eventSwcPlugins(
events.push({
eventName: EVENT_SWC_PLUGIN_PRESENT,
payload: {
packageName: plugin,
packageVersion: version,
pluginName: plugin,
pluginVersion: version,
},
})

Expand Down
14 changes: 6 additions & 8 deletions test/integration/telemetry/test/index.test.js
Expand Up @@ -843,19 +843,17 @@ describe('Telemetry CLI', () => {
const regex = /NEXT_SWC_PLUGIN_DETECTED[\s\S]+?{([\s\S]+?)}/g

const coverage = regex.exec(stderr).pop()
expect(coverage).toContain(
`"packageName": "swc-plugin-coverage-instrument"`
)
expect(coverage).toContain(`"packageVersion": "0.0.6"`)
expect(coverage).toContain(`"pluginName": "swc-plugin-coverage-instrument"`)
expect(coverage).toContain(`"pluginVersion": "0.0.6"`)

const relay = regex.exec(stderr).pop()
expect(relay).toContain(`"packageName": "@swc/plugin-relay"`)
expect(relay).toContain(`"packageVersion": "0.2.0"`)
expect(relay).toContain(`"pluginName": "@swc/plugin-relay"`)
expect(relay).toContain(`"pluginVersion": "0.2.0"`)

const absolute = regex.exec(stderr).pop()
expect(absolute).toContain(
`"packageName": "/test/absolute_path/plugin.wasm"`
`"pluginName": "/test/absolute_path/plugin.wasm"`
)
expect(absolute).not.toContain(`packageVersion`)
expect(absolute).not.toContain(`pluginVersion`)
})
})