diff --git a/lib/modules/versioning/hashicorp/convertor.spec.ts b/lib/modules/versioning/hashicorp/convertor.spec.ts index 29e682fcc7bad5c501e96558ea88a218ffe1affc..bd3ed56e4748d7344b5c9f7e8d91f092ca8b3b81 100644 --- a/lib/modules/versioning/hashicorp/convertor.spec.ts +++ b/lib/modules/versioning/hashicorp/convertor.spec.ts @@ -50,6 +50,7 @@ describe('modules/versioning/hashicorp/convertor', () => { ${'~> 4.0'} | ${'~4'} ${'~> 4.0.0'} | ${'~4.0'} ${'~> 4.1.0'} | ${'~4.1'} + ${'4.1.0'} | ${'v4.1.0'} `('npm2hashicorp("$npm") === $hashicorp', ({ hashicorp, npm }) => { expect(npm2hashicorp(npm)).toBe(hashicorp); }); diff --git a/lib/modules/versioning/hashicorp/convertor.ts b/lib/modules/versioning/hashicorp/convertor.ts index 5dabfb54146d616b5bf538b55137c39d5e69ef7f..cf5ba17cdb275a0fc9d6c0c302ebe70aa4a502cc 100644 --- a/lib/modules/versioning/hashicorp/convertor.ts +++ b/lib/modules/versioning/hashicorp/convertor.ts @@ -55,7 +55,7 @@ export function npm2hashicorp(input: string): string { .split(' ') .map((single) => { const r = single.match( - regEx(/^(|>|<|>=|<=|~|\^)((\d+)(\.\d+){0,2}[\w-]*)$/) + regEx(/^(|>|<|>=|<=|~|\^)v?((\d+)(\.\d+){0,2}[\w-]*)$/) ); if (!r) { throw new Error('invalid npm constraint');