mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 04:22:04 +00:00
* refactor and add test to changelog * group changelog into areas * remove revert and reverted commits from changelog * make sure Revert commits that revert a commit in a previous changelog are not filtered * run "yarn test" as part of "yarn test-unit" * remove advanced syntax * remove advanced syntax * temp changelog * remove temp changelog * remove global jest config * Delete symlink * scope jest dir to just the test files we care about
52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
const childProcess = require('child_process');
|
|
|
|
const parseCommits = require('../../../utils/changelog/parse');
|
|
|
|
jest.mock('child_process');
|
|
|
|
describe('changelog', () => {
|
|
describe('parse', () => {
|
|
const logLines = [
|
|
'[cli] Add "outDir" to `tsconfig.json` (#6566) [Nathan Rajlich] &&& 073f353fcf1944633bb43119c8ffcff46eea0480',
|
|
'[frameworks][cli] Disable blank issues again [Leo Lamprecht] &&& 17fd88e044a807adf4ee6ed662cdb7c7556e912d',
|
|
'Revert "[cli] Switch from hardlinks to symlinks in vc build" (#7054) [Andy] &&& a1787c740de0d9004e11f7666b6014f820d3c523',
|
|
];
|
|
|
|
it('should group commits by area', async () => {
|
|
childProcess.execSync.mockReturnValue(`does some work`);
|
|
childProcess.execSync.mockReturnValueOnce(
|
|
`This reverts commit 17fd88e044a807adf4ee6ed662cdb7c7556e912d.`
|
|
);
|
|
|
|
let commits = parseCommits(logLines);
|
|
expect(commits).toEqual([
|
|
{
|
|
areas: ['cli'],
|
|
hash: '073f353fcf1944633bb43119c8ffcff46eea0480',
|
|
message:
|
|
'This reverts commit 17fd88e044a807adf4ee6ed662cdb7c7556e912d.',
|
|
revertsHashes: ['17fd88e044a807adf4ee6ed662cdb7c7556e912d'],
|
|
subject:
|
|
'[cli] Add "outDir" to `tsconfig.json` (#6566) [Nathan Rajlich]',
|
|
},
|
|
{
|
|
areas: ['frameworks', 'cli'],
|
|
hash: '17fd88e044a807adf4ee6ed662cdb7c7556e912d',
|
|
message: 'does some work',
|
|
revertsHashes: [],
|
|
subject:
|
|
'[frameworks][cli] Disable blank issues again [Leo Lamprecht]',
|
|
},
|
|
{
|
|
areas: ['UNCATEGORIZED'],
|
|
hash: 'a1787c740de0d9004e11f7666b6014f820d3c523',
|
|
message: 'does some work',
|
|
revertsHashes: [],
|
|
subject:
|
|
'Revert "[cli] Switch from hardlinks to symlinks in vc build" (#7054) [Andy]',
|
|
},
|
|
]);
|
|
});
|
|
});
|
|
});
|