Skip to content

Commit 229c86c

Browse files
author
roman.vasilev
committed
fix: Trim trailing line
1 parent b5dd0af commit 229c86c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'no-unused-vars': 0,
2727
'indent': 0,
2828
'no-dupe-class-members': 0,
29+
'no-console': 1,
2930
'unicorn/import-index': 0,
3031
'unicorn/catch-error-name': 0,
3132
'import/newline-after-import': 0,

src/index.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ import * as lib from './index';
55
it('smoke', () => {
66
expect(lib).toBeTruthy();
77
});
8+
9+
it('new line is trimmed', () => {
10+
const result = lib.getLastTagSync();
11+
expect(result.slice(-1)).toNotEqual('\n');
12+
});
13+

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export function getLastTagSync(match?: string) {
88
tagsOption = `--tags="${match}"`;
99
}
1010
const ref = execSync(`git rev-list --max-count=1 ${tagsOption}`, { encoding: 'utf8' });
11-
return execSync(`git describe --tags ${ref}`, { encoding: 'utf8' });
11+
const result = execSync(`git describe --tags ${ref}`, { encoding: 'utf8' });
12+
return result.trim();
1213
}
1314

1415
/**

0 commit comments

Comments
 (0)