Skip to content

Commit

Permalink
Add test (related to #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Feb 15, 2023
1 parent e41e7d3 commit ff9f1aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ have the correct version.)
Default value: `false`

Use `true` to strictly follow semver, also in consecutive pre-releases. This means that from a pre-release, a
recommended bump will result in a next pre-release for the next version. For example, from `1.0.0-alpha.0` a recommended
bump of `minor` will result in a `preminor` bump to `1.1.0-alpha.0` (whereas the default behavior without this flag
results in a `prerelease` bump to `1.0.0-alpha.1`).
recommended bump will result in a next pre-release for the next version.

For example, from `1.0.0-alpha.0` a recommended bump of `minor` will result in a `preminor` bump to `1.1.0-alpha.0`
(whereas the default behavior without this flag results in a `prerelease` bump to `1.0.0-alpha.1`).

### `context`

Expand Down
15 changes: 14 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ test('should use recommended bump (after pre-rerelease)', async t => {
assert.equal(version, '1.1.0');
});

test('should follow true semver (pre-release continuation)', async t => {
test('should follow strict semver (pre-release continuation)', async t => {
setup();
sh.exec(`git tag 1.1.0-alpha.0`);
add('feat', 'baz');
Expand All @@ -200,6 +200,19 @@ test('should follow true semver (pre-release continuation)', async t => {
assert.equal(version, '1.2.0-alpha.0');
});

test('should follow strict semver (pre-release continuation, conventionalcommits)', async t => {
setup();
sh.exec(`git tag 2.0.1-alpha.0`);
sh.ShellString('file').toEnd('file');
sh.exec(`git add file`);
sh.exec(`git commit -m "feat: new feature"`);

const [config, container] = getOptions({ preset: 'conventionalcommits', strictSemVer: true });
config.preRelease = 'alpha';
const { version } = await runTasks(config, container);
assert.equal(version, '2.1.0-alpha.0');
});

test('should use provided increment', async () => {
setup();
sh.exec(`git tag 1.0.0`);
Expand Down

0 comments on commit ff9f1aa

Please sign in to comment.