You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`Not on ${allowedBranches.map(br=>`\`${br}\``).join('/')} branch. Use --any-branch to publish anyway, or set a different release branch using --branch.`);
Copy file name to clipboardExpand all lines: test/git-tasks.js
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,19 @@ test.beforeEach(() => {
24
24
execaStub.resetStub();
25
25
});
26
26
27
+
test.serial('should fail when release branch is not specified, current branch is not main/master and publishing from any branch not permitted',asynct=>{
28
+
execaStub.createStub([
29
+
{
30
+
command: 'git symbolic-ref --short HEAD',
31
+
exitCode: 0,
32
+
stdout: 'feature'
33
+
}
34
+
]);
35
+
awaitt.throwsAsync(run(testedModule({})),
36
+
{message: 'Not on `main`/`master` branch. Use --any-branch to publish anyway, or set a different release branch using --branch.'});
37
+
t.true(SilentRenderer.tasks.some(task=>task.title==='Check current branch'&&task.hasFailed()));
38
+
});
39
+
27
40
test.serial('should fail when current branch is not the specified release branch and publishing from any branch not permitted',asynct=>{
28
41
execaStub.createStub([
29
42
{
@@ -32,8 +45,8 @@ test.serial('should fail when current branch is not the specified release branch
0 commit comments