fix(commitinfo): update project metadata and make commit info generation compatible with current tooling
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import { tap } from '@git.zone/tstest/tapbundle';
|
||||
import * as commitinfo from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
const testDir = path.join(process.cwd(), '.nogit', 'commitinfo-test');
|
||||
fs.rmSync(testDir, { recursive: true, force: true });
|
||||
fs.mkdirSync(path.join(testDir, 'ts'), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(testDir, 'package.json'),
|
||||
JSON.stringify(
|
||||
{
|
||||
name: '@push.rocks/commitinfo-test',
|
||||
version: '1.0.0',
|
||||
description: 'test package',
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
);
|
||||
|
||||
const testCommitinfo = new commitinfo.CommitInfo(testDir, 'patch');
|
||||
await testCommitinfo.writeIntoPotentialDirs();
|
||||
const commitInfoFile = fs.readFileSync(path.join(testDir, 'ts', '00_commitinfo_data.ts'), 'utf8');
|
||||
if (!commitInfoFile.includes("version: '1.0.1'")) {
|
||||
throw new Error('Expected commitinfo to write the next patch version.');
|
||||
}
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user