Repository: intuit/auto
Pull request #898 (2020-01-25 07:59:17)

Add html details option to canary hook + Use in npm plugin
# What Changed

Adds a new possible return type to the `canary` hook. This return type will render in a HTML details element.

# Why

Provides a better install experience for canaries.

Todo:

- [x] Add tests

<!-- GITHUB_RELEASE PR BODY: canary-version -->
<details>
  <summary>📦 Published PR as canary version: <code>under canary scope @auto-canary@9.4.0-canary.898.11744.0</code></summary>
  <br />
  
  :sparkles: Test out this PR locally via:
  
  ```sh
  npm install @auto-canary/auto@9.4.0-canary.898.11744.0
  npm install @auto-canary/core@9.4.0-canary.898.11744.0
  npm install @auto-canary/all-contributors@9.4.0-canary.898.11744.0
  npm install @auto-canary/chrome@9.4.0-canary.898.11744.0
  npm install @auto-canary/conventional-commits@9.4.0-canary.898.11744.0
  npm install @auto-canary/crates@9.4.0-canary.898.11744.0
  npm install @auto-canary/first-time-contributor@9.4.0-canary.898.11744.0
  npm install @auto-canary/git-tag@9.4.0-canary.898.11744.0
  npm install @auto-canary/jira@9.4.0-canary.898.11744.0
  npm install @auto-canary/maven@9.4.0-canary.898.11744.0
  npm install @auto-canary/npm@9.4.0-canary.898.11744.0
  npm install @auto-canary/omit-commits@9.4.0-canary.898.11744.0
  npm install @auto-canary/omit-release-notes@9.4.0-canary.898.11744.0
  npm install @auto-canary/released@9.4.0-canary.898.11744.0
  npm install @auto-canary/s3@9.4.0-canary.898.11744.0
  npm install @auto-canary/slack@9.4.0-canary.898.11744.0
  npm install @auto-canary/twitter@9.4.0-canary.898.11744.0
  npm install @auto-canary/upload-assets@9.4.0-canary.898.11744.0
  # or 
  yarn add @auto-canary/auto@9.4.0-canary.898.11744.0
  yarn add @auto-canary/core@9.4.0-canary.898.11744.0
  yarn add @auto-canary/all-contributors@9.4.0-canary.898.11744.0
  yarn add @auto-canary/chrome@9.4.0-canary.898.11744.0
  yarn add @auto-canary/conventional-commits@9.4.0-canary.898.11744.0
  yarn add @auto-canary/crates@9.4.0-canary.898.11744.0
  yarn add @auto-canary/first-time-contributor@9.4.0-canary.898.11744.0
  yarn add @auto-canary/git-tag@9.4.0-canary.898.11744.0
  yarn add @auto-canary/jira@9.4.0-canary.898.11744.0
  yarn add @auto-canary/maven@9.4.0-canary.898.11744.0
  yarn add @auto-canary/npm@9.4.0-canary.898.11744.0
  yarn add @auto-canary/omit-commits@9.4.0-canary.898.11744.0
  yarn add @auto-canary/omit-release-notes@9.4.0-canary.898.11744.0
  yarn add @auto-canary/released@9.4.0-canary.898.11744.0
  yarn add @auto-canary/s3@9.4.0-canary.898.11744.0
  yarn add @auto-canary/slack@9.4.0-canary.898.11744.0
  yarn add @auto-canary/twitter@9.4.0-canary.898.11744.0
  yarn add @auto-canary/upload-assets@9.4.0-canary.898.11744.0
  ```
</details>
<!-- GITHUB_RELEASE PR BODY: canary-version -->



Patch:
diff --git a/.all-contributorsrc b/.all-contributorsrc
index d28ed7d3..99876cf4 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -187,16 +187,6 @@
       "contributions": [
         "code"
       ]
-    },
-    {
-      "login": "ericclemmons",
-      "name": "Eric Clemmons",
-      "avatar_url": "https://avatars0.githubusercontent.com/u/15182?v=4",
-      "profile": "https://ericclemmons.com/",
-      "contributions": [
-        "code",
-        "doc"
-      ]
     }
   ],
   "commitConvention": "none"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20bc0e5a..8b1432a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,21 +1,3 @@
-# v9.3.3 (Fri Jan 24 2020)
-
-#### 🐛  Bug Fix
-
-- `@auto-it/core`
-  - Add 📦 emoji to canary PR message to make it more noticeable [#897](https://github.com/intuit/auto/pull/897) ([@ericclemmons](https://github.com/ericclemmons))
-
-#### 📝  Documentation
-
-- `@auto-it/all-contributors`
-  - Explicitly add npm & yarn step for all-contributors [#895](https://github.com/intuit/auto/pull/895) ([@ericclemmons](https://github.com/ericclemmons))
-
-#### Authors: 1
-
-- Eric Clemmons ([@ericclemmons](https://github.com/ericclemmons))
-
----
-
 # v9.3.2 (Fri Jan 24 2020)
 
 #### 🐛  Bug Fix
diff --git a/Formula/auto.rb b/Formula/auto.rb
index e3408422..f1ceb09e 100644
--- a/Formula/auto.rb
+++ b/Formula/auto.rb
@@ -1,8 +1,8 @@
 class Auto < Formula
   desc "Generate releases based on semantic version labels on pull requests."
   homepage "https://intuit.github.io/auto/home.html"
-  url "https://github.com/intuit/auto/releases/download/v9.3.3/auto-macos.gz"
-  sha256 "cc5ccc4e84c00a09980a24d79d11d637b43581fac03ada447cd111a8320cb96e"
+  url "https://github.com/intuit/auto/releases/download/v9.3.2/auto-macos.gz"
+  sha256 "0a7d542970929de3d9e4d936e8556a6d5a68d5e1ab9f3a75f8b05279b223cfa8"
 
   def install
     libexec.install Dir["*"]
diff --git a/README.md b/README.md
index cc7a05f3..89b398b8 100644
--- a/README.md
+++ b/README.md
@@ -190,7 +190,6 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
     <td align="center"><a href="http://brianmuenzenmeyer.com"><img src="https://avatars1.githubusercontent.com/u/298435?v=4" width="100px;" alt=""/><br /><sub><b>Brian Muenzenmeyer</b></sub></a><br /><a href="https://github.com/intuit/auto/commits?author=bmuenzenmeyer" title="Documentation">📖</a></td>
     <td align="center"><a href="https://github.com/sarah-vanderlaan"><img src="https://avatars0.githubusercontent.com/u/32620284?v=4" width="100px;" alt=""/><br /><sub><b>Sarah van der Laan</b></sub></a><br /><a href="https://github.com/intuit/auto/commits?author=sarah-vanderlaan" title="Documentation">📖</a></td>
     <td align="center"><a href="https://github.com/reckter"><img src="https://avatars1.githubusercontent.com/u/1771450?v=4" width="100px;" alt=""/><br /><sub><b>Hannes Güdelhöfer</b></sub></a><br /><a href="https://github.com/intuit/auto/commits?author=reckter" title="Code">💻</a></td>
-    <td align="center"><a href="https://ericclemmons.com/"><img src="https://avatars0.githubusercontent.com/u/15182?v=4" width="100px;" alt=""/><br /><sub><b>Eric Clemmons</b></sub></a><br /><a href="https://github.com/intuit/auto/commits?author=ericclemmons" title="Code">💻</a> <a href="https://github.com/intuit/auto/commits?author=ericclemmons" title="Documentation">📖</a></td>
   </tr>
 </table>
 
diff --git a/docs/pages/writing-plugins.md b/docs/pages/writing-plugins.md
index 3d064d77..615a7f31 100644
--- a/docs/pages/writing-plugins.md
+++ b/docs/pages/writing-plugins.md
@@ -316,6 +316,11 @@ Ran after the package has been published.
 
 Used to publish a canary release. In this hook you get the semver bump and the unique canary postfix ID.
 
+You can either return a string value of just the version or an object containing the following which will be rendered within and HTML details element.
+
+- `newVersion` - The version published in the canary release or a header for the details element.
+- `details` - The body of the details element
+
 ```ts
 auto.hooks.canary.tapPromise(this.name, async (version, postFix) => {
   const lastRelease = await auto.git!.getLatestRelease();
diff --git a/lerna.json b/lerna.json
index 0eed1f02..7c5a0883 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
 {
-  "version": "9.3.3",
+  "version": "9.3.2",
   "npmClient": "yarn",
   "useWorkspaces": true,
   "packages": [
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 8771b32d..0db81f80 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -2,7 +2,7 @@
   "name": "auto",
   "bin": "dist/bin/auto.js",
   "description": "CLI tools to help facilitate semantic versioning based on GitHub PR labels",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "author": {
     "name": "Andrew Lisowski",
     "email": "lisowski54@gmail.com"
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index b21cfc75..734d76eb 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,15 +1,3 @@
-# v9.3.3 (Fri Jan 24 2020)
-
-#### 🐛  Bug Fix
-
-- Add :package: emoji to canary PR message to make it more noticeable  ([@ericclemmons](https://github.com/ericclemmons))
-
-#### Authors: 1
-
-- Eric Clemmons ([@ericclemmons](https://github.com/ericclemmons))
-
----
-
 # v9.3.2 (Fri Jan 24 2020)
 
 #### 🐛  Bug Fix
diff --git a/packages/core/package.json b/packages/core/package.json
index cb324460..4fc8790c 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/core",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "description": "Node API for using auto.",
   "main": "dist/auto.js",
   "author": {
diff --git a/packages/core/src/auto.ts b/packages/core/src/auto.ts
index 533f4fec..ecd158df 100644
--- a/packages/core/src/auto.ts
+++ b/packages/core/src/auto.ts
@@ -82,6 +82,16 @@ interface ShipitInfo {
   context: ShipitContext;
 }
 
+/** Make a HTML detail */
+const makeDetail = (summary: string, body: string) => endent`
+  <details>
+    <summary>${summary}</summary>
+    <br />
+    
+    ${body}
+  </details>
+`;
+
 export interface IAutoHooks {
   /** Modify what is in the config. You must return the config in this hook. */
   modifyConfig: SyncWaterfallHook<[IAutoConfig]>;
@@ -143,6 +153,12 @@ export interface IAutoHooks {
   canary: AsyncSeriesBailHook<
     [SEMVER, string],
     | string
+    | {
+        /** A summary to use in a details html element */
+        newVersion: string;
+        /** The details to use in a details html element */
+        details: string;
+      }
     | {
         /** Error when creating the canary release */
         error: string;
@@ -742,6 +758,7 @@ export default class Auto {
       calculateSemVerBump(labels, this.semVerLabels!, this.config) ||
       SEMVER.patch;
     let canaryVersion = '';
+    let newVersion = '';
 
     if (pr) {
       canaryVersion = `${canaryVersion}.${pr}`;
@@ -755,8 +772,6 @@ export default class Auto {
       canaryVersion = `${canaryVersion}.${await this.git.getSha(true)}`;
     }
 
-    let newVersion = '';
-
     if (options.dryRun) {
       this.logger.log.warn(
         `Published canary identifier would be: "-canary${canaryVersion}"`
@@ -765,7 +780,7 @@ export default class Auto {
       this.logger.verbose.info('Calling canary hook');
       const result = await this.hooks.canary.promise(version, canaryVersion);
 
-      if (typeof result === 'object') {
+      if (typeof result === 'object' && 'error' in result) {
         this.logger.log.warn(result.error);
         return;
       }
@@ -774,20 +789,26 @@ export default class Auto {
         return;
       }
 
-      newVersion = result;
-      const message =
-        options.message || '📦 Published PR as canary version: %v';
+      newVersion = typeof result === 'string' ? result : result.newVersion;
+      const messageHeader = (
+        options.message || '📦 Published PR as canary version: %v'
+      ).replace(
+        '%v',
+        !newVersion || newVersion.includes('\n')
+          ? newVersion
+          : `<code>${newVersion}</code>`
+      );
+
+      if (options.message !== 'false' && pr) {
+        const message =
+          typeof result === 'string'
+            ? messageHeader
+            : makeDetail(messageHeader, result.details);
 
-      if (message !== 'false' && pr) {
         await this.prBody({
           pr: Number(pr),
           context: 'canary-version',
-          message: message.replace(
-            '%v',
-            !newVersion || newVersion.includes('\n')
-              ? newVersion
-              : `\`${newVersion}\``
-          )
+          message
         });
       }
 
@@ -1078,15 +1099,9 @@ export default class Auto {
     const prNumber = getPrNumberFromEnv(pr);
 
     if (!prNumber) {
-      this.logger.log.error(
-        endent`
-          Could not detect PR number. ${command} must be run from either a PR or have the PR number supplied via the --pr flag.
-          
-          In some CIs your branch might be built before you open a PR and posting the canary version will fail. In this case subsequent builds should succeed. 
-        `
+      throw new Error(
+        `Could not detect PR number. ${command} must be run from either a PR or have the PR number supplied via the --pr flag.`
       );
-
-      process.exit(1);
     }
 
     return prNumber;
diff --git a/plugins/all-contributors/CHANGELOG.md b/plugins/all-contributors/CHANGELOG.md
index 1f291e45..6aac646d 100644
--- a/plugins/all-contributors/CHANGELOG.md
+++ b/plugins/all-contributors/CHANGELOG.md
@@ -1,18 +1,3 @@
-# v9.3.3 (Fri Jan 24 2020)
-
-#### 🐛  Bug Fix
-
-- Explicitly add npm & yarn step
-
-install-peerdeps wasn't installing anything after prompting to use yarn
-or not  ([@ericclemmons](https://github.com/ericclemmons))
-
-#### Authors: 1
-
-- Eric Clemmons ([@ericclemmons](https://github.com/ericclemmons))
-
----
-
 # v9.2.0 (Thu Jan 23 2020)
 
 #### 🐛  Bug Fix
diff --git a/plugins/all-contributors/package.json b/plugins/all-contributors/package.json
index 24364e09..2e6cbc35 100644
--- a/plugins/all-contributors/package.json
+++ b/plugins/all-contributors/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/all-contributors",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Automatically add contributors as changelogs are produced.",
   "author": {
diff --git a/plugins/chrome/package.json b/plugins/chrome/package.json
index f1c92d3a..6eceb464 100644
--- a/plugins/chrome/package.json
+++ b/plugins/chrome/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/chrome",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Chrome publishing plugin for auto",
   "author": {
diff --git a/plugins/conventional-commits/package.json b/plugins/conventional-commits/package.json
index 0a844377..27c9539a 100644
--- a/plugins/conventional-commits/package.json
+++ b/plugins/conventional-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/conventional-commits",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Conventional commit plugin for auto",
   "author": {
diff --git a/plugins/crates/package.json b/plugins/crates/package.json
index 6387ad4d..248ce0a3 100644
--- a/plugins/crates/package.json
+++ b/plugins/crates/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/crates",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Deploy Rust crates to crates.io",
   "author": {
diff --git a/plugins/first-time-contributor/package.json b/plugins/first-time-contributor/package.json
index 6dc84bdf..909d5c2f 100644
--- a/plugins/first-time-contributor/package.json
+++ b/plugins/first-time-contributor/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/first-time-contributor",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Thank first time contributors for their work right in your release notes.",
   "author": {
diff --git a/plugins/git-tag/package.json b/plugins/git-tag/package.json
index 9a3067a3..dc07781b 100644
--- a/plugins/git-tag/package.json
+++ b/plugins/git-tag/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/git-tag",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Manage your projects version through just a git tag",
   "author": {
diff --git a/plugins/jira/package.json b/plugins/jira/package.json
index 9168bfc5..b25575b7 100644
--- a/plugins/jira/package.json
+++ b/plugins/jira/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/jira",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Jira plugin for auto",
   "author": {
diff --git a/plugins/maven/package.json b/plugins/maven/package.json
index ca9cf3f0..9470a711 100644
--- a/plugins/maven/package.json
+++ b/plugins/maven/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/maven",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Maven publishing plugin for auto",
   "author": {
diff --git a/plugins/npm/package.json b/plugins/npm/package.json
index 00f00f4d..860bb783 100644
--- a/plugins/npm/package.json
+++ b/plugins/npm/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/npm",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "NPM publishing plugin for auto",
   "author": {
diff --git a/plugins/npm/src/index.ts b/plugins/npm/src/index.ts
index c5996dcc..f7f880a9 100644
--- a/plugins/npm/src/index.ts
+++ b/plugins/npm/src/index.ts
@@ -307,9 +307,16 @@ async function gitReset() {
   await execPromise('git', ['reset', '--hard', 'HEAD']);
 }
 
-/** Make a HTML detail */
-const makeDetail = (summary: string, body: string[]) =>
-  `<details><summary>${summary}</summary>\n${markdownList(body)}</details>`;
+/** Make install instructions for multiple repos */
+const makeMonorepoInstallList = (packageList: string[]) =>
+  [
+    ':sparkles: Test out this PR locally via:\n',
+    '```sh',
+    ...packageList.map(p => `npm install ${p}`),
+    '# or ',
+    ...packageList.map(p => `yarn add ${p}`),
+    '```'
+  ].join('\n');
 
 /** Publish to NPM. Works in both a monorepo setting and for a single package. */
 export default class NPMPlugin implements IPlugin {
@@ -589,7 +596,10 @@ export default class NPMPlugin implements IPlugin {
             return { error: 'No packages were changed. No canary published.' };
           }
 
-          return makeDetail('Canary Versions', packageList);
+          return {
+            newVersion: 'Canary Versions',
+            details: makeMonorepoInstallList(packageList)
+          };
         }
 
         const versioned = packages.find(p => p.version.includes('canary'));
@@ -600,14 +610,14 @@ export default class NPMPlugin implements IPlugin {
 
         const version = versioned.version.split('+')[0];
 
-        return this.canaryScope
-          ? makeDetail(
-              `Published under canary scope @${sanitizeScope(
+        return {
+          newVersion: this.canaryScope
+            ? `under canary scope @${sanitizeScope(
                 this.canaryScope
-              )}`,
-              packageList
-            )
-          : version;
+              )}@${version}`
+            : version,
+          details: makeMonorepoInstallList(packageList)
+        };
       }
 
       auto.logger.verbose.info('Detected single npm package');
@@ -637,8 +647,13 @@ export default class NPMPlugin implements IPlugin {
         await gitReset();
       }
 
+      const { name } = await loadPackageJson();
       auto.logger.verbose.info('Successfully published canary version');
-      return canaryVersion;
+
+      return {
+        newVersion: canaryVersion,
+        details: makeMonorepoInstallList([`${name}@${canaryVersion}`])
+      };
     });
 
     auto.hooks.next.tapPromise(this.name, async (preReleaseVersions, bump) => {
diff --git a/plugins/omit-commits/package.json b/plugins/omit-commits/package.json
index b813f814..cb8d4021 100644
--- a/plugins/omit-commits/package.json
+++ b/plugins/omit-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-commits",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Omit commits plugin for auto",
   "author": {
diff --git a/plugins/omit-release-notes/package.json b/plugins/omit-release-notes/package.json
index 9fe35478..c610a068 100644
--- a/plugins/omit-release-notes/package.json
+++ b/plugins/omit-release-notes/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-release-notes",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Omit release notes plugin for auto",
   "author": {
diff --git a/plugins/released/package.json b/plugins/released/package.json
index e3f6f5ab..b2e04e07 100644
--- a/plugins/released/package.json
+++ b/plugins/released/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/released",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Released plugin for auto. Comments with version + extra",
   "author": {
diff --git a/plugins/s3/package.json b/plugins/s3/package.json
index ddd98a4d..195adf0e 100644
--- a/plugins/s3/package.json
+++ b/plugins/s3/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/s3",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Post your built artifacts to s3",
   "author": {
diff --git a/plugins/slack/package.json b/plugins/slack/package.json
index 5c96a66f..576d532e 100644
--- a/plugins/slack/package.json
+++ b/plugins/slack/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/slack",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Slack plugin for auto",
   "author": {
diff --git a/plugins/twitter/package.json b/plugins/twitter/package.json
index 14f3f90a..f978debd 100644
--- a/plugins/twitter/package.json
+++ b/plugins/twitter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/twitter",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Twitter plugin for auto",
   "author": {
diff --git a/plugins/upload-assets/package.json b/plugins/upload-assets/package.json
index cf1e0157..b2631c60 100644
--- a/plugins/upload-assets/package.json
+++ b/plugins/upload-assets/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/upload-assets",
-  "version": "9.3.3",
+  "version": "9.3.2",
   "main": "dist/index.js",
   "description": "Upload assets plugin for auto",
   "author": {


Test patch:
diff --git a/packages/core/src/__tests__/auto.test.ts b/packages/core/src/__tests__/auto.test.ts
index d2668818..1b6a7a45 100644
--- a/packages/core/src/__tests__/auto.test.ts
+++ b/packages/core/src/__tests__/auto.test.ts
@@ -355,14 +355,14 @@ describe('Auto', () => {
 
     test('should catch exceptions when status fails to post', async () => {
       const auto = new Auto(defaults);
-
-      process.exit = jest.fn() as any;
       auto.logger = dummyLog();
       await auto.loadConfig();
       auto.git!.createStatus = createStatus;
+      createStatus.mockRejectedValueOnce({ status: 400 });
 
-      auto.prStatus({ ...required, sha: '1234' });
-      expect(process.exit).toHaveBeenCalled();
+      await expect(
+        auto.prStatus({ ...required, sha: '1234' })
+      ).rejects.toBeInstanceOf(Error);
       expect(createStatus).toHaveBeenCalled();
     });
 
diff --git a/plugins/npm/__tests__/npm.test.ts b/plugins/npm/__tests__/npm.test.ts
index 703824cf..a007d0dc 100644
--- a/plugins/npm/__tests__/npm.test.ts
+++ b/plugins/npm/__tests__/npm.test.ts
@@ -715,7 +715,8 @@ describe('canary', () => {
 
     const value = await hooks.canary.promise(Auto.SEMVER.patch, '');
     expect(exec.mock.calls[0][1]).toContain('lerna');
-    expect(value).toBe('1.2.3-canary.0');
+    // @ts-ignore
+    expect(value.newVersion).toBe('1.2.3-canary.0');
   });
 
   test('error when no canary release found', async () => {