Skip to content

Commit

Permalink
fix: fix regex for parsing major version update (#1330)
Browse files Browse the repository at this point in the history
* test: add failing test for parsing major version bump with PR number

* fix: fix regex for parsing major version update
  • Loading branch information
chingor13 authored Mar 8, 2022
1 parent 858199e commit afadec9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/versioning-strategies/dependency-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions test/versioning-strategies/dependency-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});

0 comments on commit afadec9

Please sign in to comment.