diff --git a/test/fixtures/multi-plugin.js b/test/fixtures/multi-plugin.cjs similarity index 89% rename from test/fixtures/multi-plugin.js rename to test/fixtures/multi-plugin.cjs index d43886e2d2..1691941cd4 100644 --- a/test/fixtures/multi-plugin.js +++ b/test/fixtures/multi-plugin.cjs @@ -1,4 +1,4 @@ -export default { +module.exports = { verifyConditions: () => {}, getLastRelease: () => {}, analyzeCommits: () => {}, diff --git a/test/fixtures/plugin-noop.cjs b/test/fixtures/plugin-noop.cjs new file mode 100644 index 0000000000..cc40a4649c --- /dev/null +++ b/test/fixtures/plugin-noop.cjs @@ -0,0 +1 @@ +module.exports = () => {}; diff --git a/test/fixtures/plugin-noop.js b/test/fixtures/plugin-noop.js deleted file mode 100644 index ead516c976..0000000000 --- a/test/fixtures/plugin-noop.js +++ /dev/null @@ -1 +0,0 @@ -export default () => {} diff --git a/test/plugins/plugins.test.js b/test/plugins/plugins.test.js index faf2c1d6dc..6b10883034 100644 --- a/test/plugins/plugins.test.js +++ b/test/plugins/plugins.test.js @@ -35,9 +35,9 @@ test('Export plugins based on steps config', async (t) => { cwd, logger: t.context.logger, options: { - verifyConditions: ['./test/fixtures/plugin-noop', {path: './test/fixtures/plugin-noop'}], - generateNotes: './test/fixtures/plugin-noop', - analyzeCommits: {path: './test/fixtures/plugin-noop'}, + verifyConditions: ['./test/fixtures/plugin-noop.cjs', {path: './test/fixtures/plugin-noop.cjs'}], + generateNotes: './test/fixtures/plugin-noop.cjs', + analyzeCommits: {path: './test/fixtures/plugin-noop.cjs'}, verifyRelease: () => {}, }, }, @@ -139,7 +139,7 @@ test('Unknown steps of plugins configured in "plugins" are ignored', async (t) = test('Export plugins loaded from the dependency of a shareable config module', async (t) => { const cwd = temporaryDirectory(); await copy( - './test/fixtures/plugin-noop.js', + './test/fixtures/plugin-noop.cjs', path.resolve(cwd, 'node_modules/shareable-config/node_modules/custom-plugin/index.js') ); await outputFile(path.resolve(cwd, 'node_modules/shareable-config/index.js'), ''); @@ -171,7 +171,7 @@ test('Export plugins loaded from the dependency of a shareable config module', a test('Export plugins loaded from the dependency of a shareable config file', async (t) => { const cwd = temporaryDirectory(); - await copy('./test/fixtures/plugin-noop.js', path.resolve(cwd, 'plugin/plugin-noop.js')); + await copy('./test/fixtures/plugin-noop.cjs', path.resolve(cwd, 'plugin/plugin-noop.cjs')); await outputFile(path.resolve(cwd, 'shareable-config.js'), ''); const plugins = await getPlugins( @@ -179,9 +179,9 @@ test('Export plugins loaded from the dependency of a shareable config file', asy cwd, logger: t.context.logger, options: { - verifyConditions: ['./plugin/plugin-noop', {path: './plugin/plugin-noop'}], - generateNotes: './plugin/plugin-noop', - analyzeCommits: {path: './plugin/plugin-noop'}, + verifyConditions: ['./plugin/plugin-noop.cjs', {path: './plugin/plugin-noop.cjs'}], + generateNotes: './plugin/plugin-noop.cjs', + analyzeCommits: {path: './plugin/plugin-noop.cjs'}, verifyRelease: () => {}, }, }, @@ -289,7 +289,7 @@ test('Throw EPLUGINSCONF error if the "plugins" option contains an old plugin de { cwd, logger: t.context.logger, - options: {plugins: ['./test/fixtures/multi-plugin', './test/fixtures/plugin-noop', () => {}]}, + options: {plugins: ['./test/fixtures/multi-plugin.cjs', './test/fixtures/plugin-noop.cjs', () => {}]}, }, {} ) diff --git a/test/plugins/utils.test.js b/test/plugins/utils.test.js index b2ac21ef97..2e9bfd95b1 100644 --- a/test/plugins/utils.test.js +++ b/test/plugins/utils.test.js @@ -1,6 +1,5 @@ import test from 'ava'; import {loadPlugin, parseConfig, validatePlugin, validateStep} from '../../lib/plugins/utils.js'; -import {imitate} from 'testdouble'; test('validatePlugin', (t) => { const path = 'plugin-module'; @@ -194,10 +193,10 @@ test('loadPlugin', async (t) => { const cwd = process.cwd(); const func = () => {}; - t.is((await import('../fixtures/plugin-noop.js')).default, await loadPlugin({cwd: './test/fixtures'}, './plugin-noop', {}), 'From cwd'); + t.is((await import('../fixtures/plugin-noop.cjs')).default, await loadPlugin({cwd: './test/fixtures'}, './plugin-noop.cjs', {}), 'From cwd'); t.is( - (await import('../fixtures/plugin-noop.js')).default, - await loadPlugin({cwd}, './plugin-noop', {'./plugin-noop': './test/fixtures'}), + (await import('../fixtures/plugin-noop.cjs')).default, + await loadPlugin({cwd}, './plugin-noop.cjs', {'./plugin-noop.cjs': './test/fixtures'}), 'From a shareable config context' ); t.is(func, await loadPlugin({cwd}, func, {}), 'Defined as a function');