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
1 change: 1 addition & 0 deletions renovate-config.json5
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"matchStrings": [
"(?<indentation>[ \\t]*)-[ \\t]*(?<depName>[A-Za-z0-9_.-]+)[ \\t]*=[ \\t]*(?<currentValue>[^=\\s#][^\\s#]*)",
],
"currentValueTemplate": "=={{{currentValue}}}",
"datasourceTemplate": "conda",
"packageNameTemplate": "conda-forge/{{{depName}}}",
"versioningTemplate": "conda",
Expand Down
19 changes: 14 additions & 5 deletions tests/renovate-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fs from 'node:fs';
import test from 'node:test';

import JSON5 from 'json5';
import {api as condaVersioning} from 'renovate/dist/modules/versioning/conda/index.js';
import {extractPackageFile as extractCdnUrlPackageFile} from 'renovate/dist/modules/manager/cdnurl/index.js';
import {extractPackageFile as extractRegexPackageFile} from 'renovate/dist/modules/manager/custom/regex/index.js';
import {compile} from 'renovate/dist/util/template/index.js';
Expand Down Expand Up @@ -132,14 +133,14 @@ dependencies:
})),
[
{
currentValue: '1.2.3',
currentValue: '==1.2.3',
datasource: 'conda',
depName: 'doxygen',
packageName: 'conda-forge/doxygen',
versioning: 'conda',
},
{
currentValue: '4.5.6',
currentValue: '==4.5.6',
datasource: 'conda',
depName: 'graphviz',
packageName: 'conda-forge/graphviz',
Expand All @@ -149,16 +150,24 @@ dependencies:
);

const dependency = dependencies[0];
const newVersion = nextTestVersion(dependency.currentValue);
const currentVersion = dependency.currentValue.replace(/^==/, '');
const newVersion = nextTestVersion(currentVersion);
const newValue = condaVersioning.getNewValue({
currentValue: dependency.currentValue,
currentVersion,
isReplacement: false,
newVersion,
rangeStrategy: 'replace',
});
const updatedReplaceString = compile(
condaEnvironmentManager.autoReplaceStringTemplate,
{...dependency, newVersion},
{...dependency, newValue, newVersion},
false,
);
const updatedContent = content.replace(dependency.replaceString, updatedReplaceString);
const updatedDependencies = extractCondaDependencies(fileName, updatedContent);

assert.equal(updatedDependencies[0].currentValue, newVersion);
assert.equal(updatedDependencies[0].currentValue, newValue);
assert.match(updatedContent, new RegExp(` - doxygen=${newVersion.replaceAll('.', '\\.')}`));
assert.match(updatedContent, / - graphviz = 4\.5\.6 # Keep an inline comment\./);
});
Expand Down