Skip to content

Commit 05c19df

Browse files
authored
Merge pull request #1019 from semantic-release/disable-dry-run
fix(publish-dry-run): temporarily remove the addition of dry-running the publish step
2 parents d321e46 + 30bd176 commit 05c19df

File tree

3 files changed

+38
-43
lines changed

3 files changed

+38
-43
lines changed

lib/verify-auth.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ async function verifyTokenAuth(registry, npmrc, context, pkgRoot) {
7777

7878
if (registryIsDefault(registry, DEFAULT_NPM_REGISTRY)) {
7979
await verifyAuthContextAgainstRegistry(npmrc, registry, context);
80-
} else {
81-
await attemptPublishDryRun(npmrc, registry, context, pkgRoot);
8280
}
8381
}
8482

test/integration.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ test("Throws error if NPM token is not provided when targeting the default regis
131131
t.is(error.message, "No npm token specified.");
132132
});
133133

134-
test("Verify the token with a publish dry-run if the registry configured is not the default one", async (t) => {
134+
test.skip("Verify the token with a publish dry-run if the registry configured is not the default one", async (t) => {
135135
const cwd = temporaryDirectory();
136136
const env = { NPM_TOKEN: "wrong_token" };
137137
const pkg = { name: "published", version: "1.0.0", publishConfig: { registry: "http://custom-registry.com/" } };

test/verify-auth.test.js

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -156,48 +156,45 @@ test.serial(
156156

157157
// since alternative registries are not consistent in implementing `npm whoami`,
158158
// the best we can attempt to verify is to do a dry run publish and check for auth warnings
159-
test.serial(
160-
"that the token is considered invalid when the publish dry run fails when publishing to a custom registry",
161-
async (t) => {
162-
const otherRegistry = "https://other.registry.org";
163-
const execaResult = Promise.resolve({
164-
stderr: ["foo", "bar", "baz", `This command requires you to be logged in to ${otherRegistry}`, "qux"],
165-
});
166-
execaResult.stderr = { pipe: () => undefined };
167-
execaResult.stdout = { pipe: () => undefined };
168-
td.when(getRegistry(pkg, context)).thenReturn(otherRegistry);
169-
td.when(oidcContextEstablished(otherRegistry, pkg, context)).thenResolve(false);
170-
td.when(
171-
execa(
172-
"npm",
173-
[
174-
"publish",
175-
cwd,
176-
"--dry-run",
177-
"--tag=semantic-release-auth-check",
178-
"--userconfig",
179-
npmrc,
180-
"--registry",
181-
otherRegistry,
182-
],
183-
{
184-
cwd,
185-
env: otherEnvVars,
186-
preferLocal: true,
187-
lines: true,
188-
}
189-
)
190-
).thenReturn(execaResult);
159+
test.skip("that the token is considered invalid when the publish dry run fails when publishing to a custom registry", async (t) => {
160+
const otherRegistry = "https://other.registry.org";
161+
const execaResult = Promise.resolve({
162+
stderr: ["foo", "bar", "baz", `This command requires you to be logged in to ${otherRegistry}`, "qux"],
163+
});
164+
execaResult.stderr = { pipe: () => undefined };
165+
execaResult.stdout = { pipe: () => undefined };
166+
td.when(getRegistry(pkg, context)).thenReturn(otherRegistry);
167+
td.when(oidcContextEstablished(otherRegistry, pkg, context)).thenResolve(false);
168+
td.when(
169+
execa(
170+
"npm",
171+
[
172+
"publish",
173+
cwd,
174+
"--dry-run",
175+
"--tag=semantic-release-auth-check",
176+
"--userconfig",
177+
npmrc,
178+
"--registry",
179+
otherRegistry,
180+
],
181+
{
182+
cwd,
183+
env: otherEnvVars,
184+
preferLocal: true,
185+
lines: true,
186+
}
187+
)
188+
).thenReturn(execaResult);
191189

192-
const {
193-
errors: [error],
194-
} = await t.throwsAsync(verifyAuth(npmrc, pkg, {}, context));
190+
const {
191+
errors: [error],
192+
} = await t.throwsAsync(verifyAuth(npmrc, pkg, {}, context));
195193

196-
t.is(error.name, "SemanticReleaseError");
197-
t.is(error.code, "EINVALIDNPMAUTH");
198-
t.is(error.message, "Invalid npm authentication.");
199-
}
200-
);
194+
t.is(error.name, "SemanticReleaseError");
195+
t.is(error.code, "EINVALIDNPMAUTH");
196+
t.is(error.message, "Invalid npm authentication.");
197+
});
201198

202199
test.serial("that errors from setting up auth bubble through this function", async (t) => {
203200
const registry = DEFAULT_NPM_REGISTRY;

0 commit comments

Comments
 (0)