diff --git a/test/fixtures/plugin-esm-named-exports.js b/test/fixtures/plugin-esm-named-exports.js new file mode 100644 index 00000000..1678f959 --- /dev/null +++ b/test/fixtures/plugin-esm-named-exports.js @@ -0,0 +1,3 @@ +export async function verifyConditions(pluginConfig, context) { + context.logger.log("verifyConditions called"); +} diff --git a/test/integration.test.js b/test/integration.test.js index 484b6136..235b1b2e 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -44,6 +44,7 @@ const cli = path.resolve("./bin/semantic-release.js"); const pluginError = path.resolve("./test/fixtures/plugin-error"); const pluginInheritedError = path.resolve("./test/fixtures/plugin-error-inherited"); const pluginLogEnv = path.resolve("./test/fixtures/plugin-log-env"); +const pluginEsmNamedExports = path.resolve("./test/fixtures/plugin-esm-named-exports"); test.before(async () => { await Promise.all([gitbox.start(), npmRegistry.start(), mockServer.start()]); @@ -713,3 +714,26 @@ test("Use the repository URL as is if none of the given git credentials are vali dummyUrl ); }); + +test("ESM Plugin with named exports", async (t) => { + const packageName = "log-secret"; + // Create a git repository, set the current working directory at the root of the repo + t.log("Create git repository"); + const { cwd, repositoryUrl } = await gitbox.createRepo(packageName); + await writeJson(path.resolve(cwd, "package.json"), { + name: packageName, + version: "0.0.0-dev", + repository: { url: repositoryUrl }, + release: { plugins: [pluginEsmNamedExports] }, + }); + + t.log("$ semantic-release"); + const { stdout, stderr } = await execa(cli, [], { + env: { ...env, MY_TOKEN: "secret token" }, + cwd, + reject: false, + extendEnv: false, + }); + + t.regex(stdout, new RegExp(`verifyConditions called`)); +});