Skip to content

Commit

Permalink
Fix specs for new from prop
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 15, 2022
1 parent f13909e commit d20e50d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -71,7 +71,7 @@ class ConventionalChangelog extends Plugin {
const options = Object.assign({}, { releaseCount }, this.options);
const context = Object.assign({ version, previousTag, currentTag }, this.options.context);
const debug = this.config.isDebug ? this.debug : null;
const gitRawCommitsOpts = Object.assign({ debug, "from": previousTag }, this.options.gitRawCommitsOpts);
const gitRawCommitsOpts = Object.assign({ debug, from: previousTag }, this.options.gitRawCommitsOpts);
const { parserOpts, writerOpts } = options;
delete options.context;
delete options.gitRawCommitsOpts;
Expand Down
11 changes: 6 additions & 5 deletions test.js
Expand Up @@ -157,7 +157,7 @@ test('should pass context and gitRawCommitsOpts', async t => {
const args = conventionalChangelog.args[0];
assert.deepStrictEqual(args[0], { releaseCount: 1, preset: 'angular', tagPrefix: '' });
assert.deepStrictEqual(args[1], { version: '1.1.0', currentTag: null, previousTag: undefined, linkCompare: false });
assert.deepStrictEqual(args[2], { debug: null, merges: true });
assert.deepStrictEqual(args[2], { debug: null, merges: true, from: undefined });
});

test('should reject if conventional bump passes error', async t => {
Expand Down Expand Up @@ -194,7 +194,7 @@ test('should pass only parserOpts', async t => {
const args = conventionalChangelog.args[0];
assert.deepStrictEqual(args[0], { releaseCount: 1, preset: 'angular', tagPrefix: '' });
assert.deepStrictEqual(args[1], { version: '1.1.0', currentTag: null, previousTag: undefined });
assert.deepStrictEqual(args[2], { debug: null });
assert.deepStrictEqual(args[2], { debug: null, from: undefined });
assert.deepStrictEqual(args[3], {
mergePattern: /^Merge pull request #(\d+) from (.*)$/,
mergeCorrespondence: ['id', 'source']
Expand All @@ -213,7 +213,7 @@ test('should pass only writerOpts', async t => {
const args = conventionalChangelog.args[0];
assert.deepStrictEqual(args[0], { releaseCount: 1, preset: 'angular', tagPrefix: '' });
assert.deepStrictEqual(args[1], { version: '1.1.0', currentTag: null, previousTag: undefined });
assert.deepStrictEqual(args[2], { debug: null });
assert.deepStrictEqual(args[2], { debug: null, from: undefined });
assert.deepStrictEqual(args[3], undefined);
assert.deepStrictEqual(args[4], {
groupBy: 'scope'
Expand All @@ -231,11 +231,12 @@ test('should pass parserOpts and writerOpts', async t => {
};
const options = { [namespace]: { preset, parserOpts, writerOpts } };
const plugin = factory(Plugin, { namespace, options });
plugin.config.setContext({ latestTag: '1.1.0' });
await runTasks(plugin);
const args = conventionalChangelog.args[0];
assert.deepStrictEqual(args[0], { releaseCount: 1, preset: 'angular', tagPrefix: '' });
assert.deepStrictEqual(args[1], { version: '1.1.0', currentTag: null, previousTag: undefined });
assert.deepStrictEqual(args[2], { debug: null });
assert.deepStrictEqual(args[1], { version: '1.1.0', currentTag: null, previousTag: '1.1.0' });
assert.deepStrictEqual(args[2], { debug: null, from: '1.1.0' });
assert.deepStrictEqual(args[3], {
mergePattern: /^Merge pull request #(\d+) from (.*)$/,
mergeCorrespondence: ['id', 'source']
Expand Down

0 comments on commit d20e50d

Please sign in to comment.