Skip to content

Commit 5b0502c

Browse files
committed
test(integration): backfill coverage for scenario when a token is not provided
this pins existing behavior for a scenario that will need to change to cover #958
1 parent bc3f066 commit 5b0502c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/integration.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ test("Throws error if NPM token is invalid", async (t) => {
111111
t.is(error.message, "Invalid npm token.");
112112
});
113113

114+
test("Throws error if NPM token is not provided", async (t) => {
115+
const cwd = temporaryDirectory();
116+
const env = { DEFAULT_NPM_REGISTRY: npmRegistry.url };
117+
const pkg = { name: "published", version: "1.0.0", publishConfig: { registry: npmRegistry.url } };
118+
await fs.outputJson(path.resolve(cwd, "package.json"), pkg);
119+
120+
const {
121+
errors: [error],
122+
} = await t.throwsAsync(
123+
t.context.m.verifyConditions(
124+
{},
125+
{ cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger }
126+
)
127+
);
128+
129+
t.is(error.name, "SemanticReleaseError");
130+
t.is(error.code, "ENONPMTOKEN");
131+
t.is(error.message, "No npm token specified.");
132+
});
133+
134+
114135
test("Skip Token validation if the registry configured is not the default one", async (t) => {
115136
const cwd = temporaryDirectory();
116137
const env = { NPM_TOKEN: "wrong_token" };

0 commit comments

Comments
 (0)