feat: add logs about prepare, publish, success and fail plugins skipped in dry-run mode
This commit is contained in:
@@ -62,7 +62,7 @@ test('Wrap plugin in a function that add the "pluginName" to the error"', async
|
||||
'./plugin-error': './test/fixtures',
|
||||
});
|
||||
|
||||
const error = await t.throws(plugin());
|
||||
const error = await t.throws(plugin({options: {}}));
|
||||
|
||||
t.is(error.pluginName, './plugin-error');
|
||||
});
|
||||
@@ -72,7 +72,7 @@ test('Wrap plugin in a function that add the "pluginName" to multiple errors"',
|
||||
'./plugin-errors': './test/fixtures',
|
||||
});
|
||||
|
||||
const errors = [...(await t.throws(plugin()))];
|
||||
const errors = [...(await t.throws(plugin({options: {}})))];
|
||||
for (const error of errors) {
|
||||
t.is(error.pluginName, './plugin-errors');
|
||||
}
|
||||
@@ -107,7 +107,7 @@ test('Wrap "analyzeCommits" plugin in a function that validate the output of the
|
||||
{}
|
||||
);
|
||||
|
||||
const error = await t.throws(plugin());
|
||||
const error = await t.throws(plugin({options: {}}));
|
||||
|
||||
t.is(error.code, 'EANALYZECOMMITSOUTPUT');
|
||||
t.is(error.name, 'SemanticReleaseError');
|
||||
@@ -125,7 +125,7 @@ test('Wrap "generateNotes" plugin in a function that validate the output of the
|
||||
{}
|
||||
);
|
||||
|
||||
const error = await t.throws(plugin());
|
||||
const error = await t.throws(plugin({options: {}}));
|
||||
|
||||
t.is(error.code, 'EGENERATENOTESOUTPUT');
|
||||
t.is(error.name, 'SemanticReleaseError');
|
||||
@@ -143,7 +143,7 @@ test('Wrap "publish" plugin in a function that validate the output of the plugin
|
||||
{}
|
||||
);
|
||||
|
||||
const error = await t.throws(plugin());
|
||||
const error = await t.throws(plugin({options: {}}));
|
||||
|
||||
t.is(error.code, 'EPUBLISHOUTPUT');
|
||||
t.is(error.name, 'SemanticReleaseError');
|
||||
@@ -157,7 +157,7 @@ test('Plugin is called with "pluginConfig" (with object definition) and input',
|
||||
const pluginConf = {path: pluginFunction, conf: 'confValue'};
|
||||
const options = {global: 'globalValue'};
|
||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||
await plugin({param: 'param'});
|
||||
await plugin({options: {}, param: 'param'});
|
||||
|
||||
t.true(
|
||||
pluginFunction.calledWithMatch(
|
||||
@@ -172,7 +172,7 @@ test('Plugin is called with "pluginConfig" (with array definition) and input', a
|
||||
const pluginConf = [pluginFunction, {conf: 'confValue'}];
|
||||
const options = {global: 'globalValue'};
|
||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||
await plugin({param: 'param'});
|
||||
await plugin({options: {}, param: 'param'});
|
||||
|
||||
t.true(
|
||||
pluginFunction.calledWithMatch(
|
||||
@@ -189,7 +189,7 @@ test('Prevent plugins to modify "pluginConfig"', async t => {
|
||||
const pluginConf = {path: pluginFunction, conf: {subConf: 'originalConf'}};
|
||||
const options = {globalConf: {globalSubConf: 'originalGlobalConf'}};
|
||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||
await plugin();
|
||||
await plugin({options: {}});
|
||||
|
||||
t.is(pluginConf.conf.subConf, 'originalConf');
|
||||
t.is(options.globalConf.globalSubConf, 'originalGlobalConf');
|
||||
@@ -199,7 +199,7 @@ test('Prevent plugins to modify its input', async t => {
|
||||
const pluginFunction = stub().callsFake((pluginConfig, options) => {
|
||||
options.param.subParam = 'otherParam';
|
||||
});
|
||||
const input = {param: {subParam: 'originalSubParam'}};
|
||||
const input = {param: {subParam: 'originalSubParam'}, options: {}};
|
||||
const plugin = normalize({cwd, options: {}, logger: t.context.logger}, '', pluginFunction, {});
|
||||
await plugin(input);
|
||||
|
||||
@@ -220,7 +220,7 @@ test('Always pass a defined "pluginConfig" for plugin defined with string', asyn
|
||||
'./test/fixtures/plugin-result-config',
|
||||
{}
|
||||
);
|
||||
const pluginResult = await plugin();
|
||||
const pluginResult = await plugin({options: {}});
|
||||
|
||||
t.deepEqual(pluginResult.pluginConfig, {});
|
||||
});
|
||||
@@ -233,7 +233,7 @@ test('Always pass a defined "pluginConfig" for plugin defined with path', async
|
||||
{path: './test/fixtures/plugin-result-config'},
|
||||
{}
|
||||
);
|
||||
const pluginResult = await plugin();
|
||||
const pluginResult = await plugin({options: {}});
|
||||
|
||||
t.deepEqual(pluginResult.pluginConfig, {});
|
||||
});
|
||||
|
||||
@@ -63,14 +63,14 @@ test('Export plugins based on "plugins" config (array)', async t => {
|
||||
{}
|
||||
);
|
||||
|
||||
await plugins.verifyConditions({});
|
||||
await plugins.verifyConditions({options: {}});
|
||||
t.true(plugin1.verifyConditions.calledOnce);
|
||||
t.true(plugin2.verifyConditions.calledOnce);
|
||||
|
||||
await plugins.publish({});
|
||||
await plugins.publish({options: {}});
|
||||
t.true(plugin1.publish.calledOnce);
|
||||
|
||||
await plugins.verifyRelease({});
|
||||
await plugins.verifyRelease({options: {}});
|
||||
t.true(plugin2.verifyRelease.notCalled);
|
||||
|
||||
// Verify the module returns a function for each plugin
|
||||
@@ -88,10 +88,10 @@ test('Export plugins based on "plugins" config (single definition)', async t =>
|
||||
const plugin1 = {verifyConditions: stub(), publish: stub()};
|
||||
const plugins = getPlugins({cwd, logger: t.context.logger, options: {plugins: plugin1}}, {});
|
||||
|
||||
await plugins.verifyConditions({});
|
||||
await plugins.verifyConditions({options: {}});
|
||||
t.true(plugin1.verifyConditions.calledOnce);
|
||||
|
||||
await plugins.publish({});
|
||||
await plugins.publish({options: {}});
|
||||
t.true(plugin1.publish.calledOnce);
|
||||
|
||||
// Verify the module returns a function for each plugin
|
||||
@@ -118,14 +118,14 @@ test('Merge global options, "plugins" options and step options', async t => {
|
||||
{}
|
||||
);
|
||||
|
||||
await plugins.verifyConditions({});
|
||||
await plugins.verifyConditions({options: {}});
|
||||
t.deepEqual(plugin1[0].verifyConditions.args[0][0], {globalOpt: 'global', pluginOpt1: 'plugin1'});
|
||||
t.deepEqual(plugin2[0].verifyConditions.args[0][0], {globalOpt: 'global', pluginOpt2: 'plugin2'});
|
||||
|
||||
await plugins.publish({});
|
||||
await plugins.publish({options: {}});
|
||||
t.deepEqual(plugin1[0].publish.args[0][0], {globalOpt: 'global', pluginOpt1: 'plugin1'});
|
||||
|
||||
await plugins.verifyRelease({});
|
||||
await plugins.verifyRelease({options: {}});
|
||||
t.deepEqual(plugin3[0].args[0][0], {globalOpt: 'global', pluginOpt3: 'plugin3'});
|
||||
});
|
||||
|
||||
@@ -248,7 +248,7 @@ test('Merge global options with plugin options', async t => {
|
||||
{}
|
||||
);
|
||||
|
||||
const [result] = await plugins.verifyRelease();
|
||||
const [result] = await plugins.verifyRelease({options: {}});
|
||||
|
||||
t.deepEqual(result.pluginConfig, {localOpt: 'local', globalOpt: 'global', otherOpt: 'locally-defined'});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user