@@ -5,6 +5,7 @@ import test from 'node:test';
55import JSON5 from 'json5' ;
66import { api as condaVersioning } from 'renovate/dist/modules/versioning/conda/index.js' ;
77import { api as looseVersioning } from 'renovate/dist/modules/versioning/loose/index.js' ;
8+ import { get as getVersioning } from 'renovate/dist/modules/versioning/index.js' ;
89import { extractPackageFile as extractCdnUrlPackageFile } from 'renovate/dist/modules/manager/cdnurl/index.js' ;
910import { massageCustomDatasourceConfig } from 'renovate/dist/modules/datasource/custom/utils.js' ;
1011import { extractPackageFile as extractRegexPackageFile } from 'renovate/dist/modules/manager/custom/regex/index.js' ;
@@ -13,8 +14,13 @@ import {getExpression} from 'renovate/dist/util/jsonata.js';
1314import { compile } from 'renovate/dist/util/template/index.js' ;
1415import { applyPackageRules } from 'renovate/dist/util/package-rules/index.js' ;
1516import { filterVersions } from 'renovate/dist/workers/repository/process/lookup/filter.js' ;
17+ import { mergeChildConfig } from 'renovate/dist/config/utils.js' ;
18+ import { presetSources , resolveConfigPresets } from 'renovate/dist/config/presets/index.js' ;
19+ import { init as initPresetCache , set as setPresetCache } from 'renovate/dist/util/cache/memory/index.js' ;
1620
17- const renovateConfig = JSON5 . parse ( fs . readFileSync ( 'renovate-config.json5' , 'utf8' ) ) ;
21+ const mainConfig = JSON5 . parse ( fs . readFileSync ( 'renovate-config.json5' , 'utf8' ) ) ;
22+ const themerrConfig = JSON5 . parse ( fs . readFileSync ( 'renovate/themerr.json5' , 'utf8' ) ) ;
23+ const renovateConfig = mergeChildConfig ( themerrConfig , mainConfig ) ;
1824const githubRefManager = renovateConfig . customManagers . find (
1925 manager => manager . description === 'Update annotated GitHub values and their jsDelivr commits' ,
2026) ;
@@ -612,3 +618,154 @@ test('extracts cdnjs imports from asset stylesheets', () => {
612618 [ [ 'normalize' , '3.0.1' ] ] ,
613619 ) ;
614620} ) ;
621+
622+
623+ test ( 'extracts Jellyfin runtime targets without updating Themerr SDK and EF baselines' , ( ) => {
624+ const manager = renovateConfig . customManagers . find (
625+ value => value . description === 'Update Themerr Jellyfin runtime validation targets' ,
626+ ) ;
627+ const fileName = 'src/jellyfin/compatibility.props' ;
628+ assert . ok ( matchesManagerFilePattern ( fileName , manager . managerFilePatterns ) ) ;
629+ assert . equal ( matchesManagerFilePattern ( 'connectors/jellyfin/Themerr.Connector.csproj' , manager . managerFilePatterns ) , false ) ;
630+ const content = `
631+ <Project>
632+ <JellyfinMinimumVersion>12.1.0</JellyfinMinimumVersion>
633+ <ConnectorEfCoreVersion>10.0.11</ConnectorEfCoreVersion>
634+ <JellyfinLatestVersion>10.11.11</JellyfinLatestVersion>
635+ <JellyfinLatestVersion>12.2</JellyfinLatestVersion>
636+ </Project>
637+ ` ;
638+ const dependencies = extractRegexPackageFile ( content , fileName , manager ) . deps ;
639+ assert . deepEqual ( dependencies . map ( value => value . currentValue ) , [
640+ '10.11.11' ,
641+ '12.2' ,
642+ ] ) ;
643+ assert . ok ( dependencies . every ( value => value . datasource === 'docker' && value . depName === 'jellyfin/jellyfin'
644+ && value . packageName === 'jellyfin/jellyfin' ) ) ;
645+ const updated = applyExtractedUpdate ( content , dependencies [ 1 ] , '12.3' ) ;
646+ assert . match ( updated , / < J e l l y f i n L a t e s t V e r s i o n > 1 2 \. 3 < \/ J e l l y f i n L a t e s t V e r s i o n > / ) ;
647+ assert . match ( updated , / < J e l l y f i n M i n i m u m V e r s i o n > 1 2 \. 1 \. 0 < \/ J e l l y f i n M i n i m u m V e r s i o n > / ) ;
648+ assert . match ( updated , / < C o n n e c t o r E f C o r e V e r s i o n > 1 0 \. 0 \. 1 1 < \/ C o n n e c t o r E f C o r e V e r s i o n > / ) ;
649+ } ) ;
650+
651+ test ( 'limits Themerr Jellyfin runtime updates to stable hotfixes in their series' , async ( ) => {
652+ const manager = renovateConfig . customManagers . find (
653+ value => value . description === 'Update Themerr Jellyfin runtime validation targets' ,
654+ ) ;
655+ for ( const [ currentValue , releases , expected ] of [
656+ [
657+ '10.11.11' ,
658+ [
659+ '10.11.12' ,
660+ '10.12.0' ,
661+ '12.2' ,
662+ '10.11.12-rc1' ,
663+ ] ,
664+ [ '10.11.12' ] ,
665+ ] ,
666+ [
667+ '12.2' ,
668+ [
669+ '12.3' ,
670+ '13.0' ,
671+ '12.3-rc1' ,
672+ ] ,
673+ [ '12.3' ] ,
674+ ] ,
675+ ] ) {
676+ const [ dependency ] = extractRegexPackageFile (
677+ `<JellyfinLatestVersion>${ currentValue } </JellyfinLatestVersion>` ,
678+ 'src/jellyfin/compatibility.props' ,
679+ manager ,
680+ ) . deps ;
681+ const resolved = await applyPackageRules ( {
682+ ...dependency ,
683+ repository : 'LizardByte/Themerr' ,
684+ packageFile : 'src/jellyfin/compatibility.props' ,
685+ packageRules : renovateConfig . packageRules ,
686+ } ) ;
687+ assert . deepEqual (
688+ filterVersions (
689+ resolved ,
690+ currentValue ,
691+ undefined ,
692+ releases . map ( version => ( { version} ) ) ,
693+ getVersioning ( resolved . versioning ) ,
694+ ) . map ( value => value . version ) ,
695+ expected ,
696+ ) ;
697+ }
698+ } ) ;
699+
700+ test ( 'pins Jellyfin SDK and EF only in Themerr connector projects' , async ( ) => {
701+ for ( const depName of [
702+ 'Jellyfin.Controller' ,
703+ 'Microsoft.EntityFrameworkCore.Sqlite' ,
704+ ] ) {
705+ for ( const [ repository , packageFile , disabled ] of [
706+ [
707+ 'LizardByte/Themerr' ,
708+ 'connectors/jellyfin/Themerr.Connector.csproj' ,
709+ true ,
710+ ] ,
711+ [
712+ 'LizardByte/Themerr' ,
713+ 'connectors/jellyfin.tests/Connector.Tests.csproj' ,
714+ true ,
715+ ] ,
716+ [
717+ 'LizardByte/Themerr-jellyfin' ,
718+ 'connectors/jellyfin/Themerr.Connector.csproj' ,
719+ false ,
720+ ] ,
721+ [
722+ 'LizardByte/Themerr' ,
723+ 'another-project/Example.csproj' ,
724+ false ,
725+ ] ,
726+ ] ) {
727+ const resolved = await applyPackageRules ( {
728+ depName,
729+ packageName : depName ,
730+ repository,
731+ packageFile,
732+ packageRules : renovateConfig . packageRules ,
733+ } ) ;
734+ assert . equal ( resolved . enabled === false , disabled , `${ repository } /${ packageFile } : ${ depName } ` ) ;
735+ }
736+ }
737+ } ) ;
738+
739+
740+ test ( 'resolves the root onboarding preset through the root main and Themerr JSON5 presets' , async context => {
741+ const rootConfig = JSON . parse ( fs . readFileSync ( 'renovate-config.json' , 'utf8' ) ) ;
742+ const mainPreset = 'github>LizardByte/.github:renovate-config.json5' ;
743+ const themerrPreset = 'github>LizardByte/.github//renovate/themerr.json5' ;
744+ assert . deepEqual ( rootConfig . extends , [ mainPreset ] ) ;
745+ assert . ok ( mainConfig . extends . includes ( themerrPreset ) ) ;
746+ assert . ok ( mainConfig . customManagers . every ( manager => manager . depNameTemplate !== 'jellyfin/jellyfin' ) ) ;
747+ assert . ok ( mainConfig . packageRules . every ( rule => ! rule . matchRepositories ?. includes ( 'LizardByte/Themerr' ) ) ) ;
748+
749+ // Resolve the actual preset chain with local contents; unexpected network fetches fail the test.
750+ initPresetCache ( ) ;
751+ setPresetCache ( `preset:${ mainPreset } ` , mainConfig ) ;
752+ setPresetCache ( `preset:${ themerrPreset } ` , themerrConfig ) ;
753+ context . mock . method ( presetSources . github , 'load' , async ( ) => {
754+ throw new Error ( 'Preset test attempted a network fetch.' ) ;
755+ } ) ;
756+ const { config, visitedPresets} = await resolveConfigPresets ( rootConfig , undefined , undefined , [ ] , false ) ;
757+ assert . deepEqual ( visitedPresets . merged , [
758+ mainPreset ,
759+ themerrPreset ,
760+ ] ) ;
761+ const manager = config . customManagers . find ( value => value . depNameTemplate === 'jellyfin/jellyfin' ) ;
762+ assert . ok ( manager , 'Expected the Themerr runtime manager in the resolved main preset' ) ;
763+ const resolved = await applyPackageRules ( {
764+ repository : 'LizardByte/Themerr' ,
765+ packageFile : 'src/jellyfin/compatibility.props' ,
766+ packageName : 'jellyfin/jellyfin' ,
767+ currentValue : '12.2' ,
768+ packageRules : config . packageRules ,
769+ } ) ;
770+ assert . equal ( resolved . allowedVersions , '/^12\\.[0-9]+$/' ) ;
771+ } ) ;
0 commit comments