mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Set Jest config file in package script Include module path Include tests in project folders Remove index module exports Hardcode configuration parameters Move parameter binding into main run function Use alias imports Run test sequentially Remove cleanup (async conflict) Revert Jest option Increase test timeout to 15 seconds
25 lines
No EOL
730 B
TypeScript
25 lines
No EOL
730 B
TypeScript
import { ActionConfig } from "../ActionConfig";
|
|
import { cmd } from "../CommandRunner";
|
|
import { CurrentCommitResolver } from "./CurrentCommitResolver";
|
|
|
|
|
|
export class DefaultCurrentCommitResolver implements CurrentCommitResolver {
|
|
|
|
private branch: string;
|
|
|
|
constructor(config: ActionConfig) {
|
|
this.branch = config.branch;
|
|
}
|
|
|
|
public async ResolveAsync(): Promise<string> {
|
|
if (this.branch === 'HEAD') {
|
|
return (await cmd('git', 'rev-parse', 'HEAD')).trim();
|
|
}
|
|
return this.branch;
|
|
}
|
|
|
|
public async IsEmptyRepoAsync(): Promise<boolean> {
|
|
let lastCommitAll = (await cmd('git', 'rev-list', '-n1', '--all')).trim();
|
|
return lastCommitAll === '';
|
|
}
|
|
} |