From afadec95aa62aa32372512455326c4cdf8943f70 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Tue, 8 Mar 2022 14:33:58 -0800 Subject: [PATCH] fix: fix regex for parsing major version update (#1330) * test: add failing test for parsing major version bump with PR number * fix: fix regex for parsing major version update --- .../dependency-manifest.ts | 2 +- .../dependency-manifest.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/versioning-strategies/dependency-manifest.ts b/src/versioning-strategies/dependency-manifest.ts index c873fe88e..6e31b7842 100644 --- a/src/versioning-strategies/dependency-manifest.ts +++ b/src/versioning-strategies/dependency-manifest.ts @@ -24,7 +24,7 @@ import { } from '../versioning-strategy'; const DEPENDENCY_UPDATE_REGEX = - /^deps: update dependency (.*) to (v.*)(\s\(#\d+\))?$/m; + /^deps: update dependency (.*) to (v[^\s]*)(\s\(#\d+\))?$/m; /** * This VersioningStrategy looks at `deps` type commits and tries to diff --git a/test/versioning-strategies/dependency-manifest.ts b/test/versioning-strategies/dependency-manifest.ts index 7ee234519..1de23910f 100644 --- a/test/versioning-strategies/dependency-manifest.ts +++ b/test/versioning-strategies/dependency-manifest.ts @@ -249,5 +249,26 @@ describe('DependencyManifest', () => { const newVersion = await strategy.bump(oldVersion, commits); expect(newVersion.toString()).to.equal('0.2.0'); }); + it('can bump a major', async () => { + const commits = [ + { + sha: 'sha2', + message: 'deps: update dependency foo to v4 (#1234)', + files: ['path1/file1.rb'], + type: 'fix', + scope: null, + bareMessage: 'some bugfix', + notes: [], + references: [], + breaking: false, + }, + ]; + const strategy = new DependencyManifest({ + bumpMinorPreMajor: true, + }); + const oldVersion = Version.parse('1.2.3'); + const newVersion = await strategy.bump(oldVersion, commits); + expect(newVersion.toString()).to.equal('2.0.0'); + }); }); });