mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +00:00
we can make a change in one of the lazy loaded files
when it is released people with an earlier core posthog
will lazy load the new version
this is an easy way for us to introduce bugs
let's run the playwright test with array.js from the currently published at the time of the PR with the new lazy loaded files to expose this
tested this by taking commit aa18871589 which introduced a breaking change bug and testing it against 1.334.1 the previous version at the time and seeing it fail
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { satisfies } from 'compare-versions'
|
|
|
|
/**
|
|
* Tests to skip for specific NPM versions during backward compatibility testing.
|
|
*
|
|
* When a compat test fails because a NEW feature isn't available in older versions
|
|
* (not a breaking change), add it here to skip the test for those versions.
|
|
*
|
|
* IMPORTANT: Only skip tests for NEW features. If an EXISTING feature breaks,
|
|
* that's a real bug that needs fixing, not skipping.
|
|
*
|
|
* Format: Map of version ranges to test patterns with required reasons
|
|
*
|
|
|
|
*/
|
|
export const compatSkips: { range: string; test: string; reason: string }[] = [
|
|
{
|
|
range: '<1.335.0',
|
|
test: 'web_vitals_attribution: true includes attribution data',
|
|
reason: 'web_vitals_attribution option added in #2953',
|
|
},
|
|
]
|
|
|
|
export function shouldSkipForVersion(testTitle: string, npmVersion: string | undefined): string | null {
|
|
if (!npmVersion) {
|
|
return null
|
|
}
|
|
|
|
for (const skip of compatSkips) {
|
|
if (new RegExp(skip.test).test(testTitle) && satisfies(npmVersion, skip.range)) {
|
|
return `Skipped for ${skip.range}: ${skip.reason}`
|
|
}
|
|
}
|
|
|
|
return null
|
|
}
|