Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions packages/build/src/plugins/compatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,37 @@ test('`getExpectedVersion` should retrieve the plugin based on conditions and fe
expect(version3).toBe('5.0.0-beta.1')
})

test('`getExpectedVersion` should work with rc versions inside the siteDependencies constraints', async () => {
const versions: PluginVersion[] = [
{
version: '5.0.0-beta.1',
conditions: [
{ type: 'nodeVersion', condition: '>= 18.0.0' },
{ type: 'siteDependencies', condition: { next: '>=13.5.0' } },
],
overridePinnedVersion: '>=4.0.0',
},
{
version: '4.42.0',
conditions: [{ type: 'siteDependencies', condition: { next: '>=10.0.9' } }],
},
{ version: '4.41.2', conditions: [] },
{
version: '3.9.2',
conditions: [{ type: 'siteDependencies', condition: { next: '<10.0.9' } }],
},
]

const { version } = await getExpectedVersion({
versions,
nodeVersion: '18.19.0',
packageJson: { dependencies: { next: '14.1.1-canary.36' } },
buildDir: '/some/path',
pinnedVersion: '4',
})
expect(version).toBe('5.0.0-beta.1')
})

test('`getExpectedVersion` should retrieve the plugin based on conditions and feature flag due to pinned version', async () => {
const versions: PluginVersion[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/plugins/plugin_conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const siteDependencyTest = async function ({

// if this is a valid version we can apply the rule directly
if (semver.clean(siteDependency) !== null) {
return semver.satisfies(siteDependency, allowedVersion)
return semver.satisfies(siteDependency, allowedVersion, { includePrerelease: true })
}

try {
Expand Down