Unverified Commit 0036a3d1 authored by OJ Kwon's avatar OJ Kwon Committed by GitHub

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

parent 0797b1a6
......@@ -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
}
}
......@@ -34,8 +34,8 @@ export async function eventSwcPlugins(
events.push({
eventName: EVENT_SWC_PLUGIN_PRESENT,
payload: {
packageName: plugin,
packageVersion: version,
pluginName: plugin,
pluginVersion: version,
},
})
......
......@@ -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`)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment