Repository: unexpectedjs/unexpected
Pull request #667 (2019-11-10 14:45:55)

Upgrade prettier to version 1.19.1





Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

### What changed?

#### ✳️ prettier (~1.18.2 → ~1.19.1) · [Repo](https://github.com/prettier/prettier) · [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)

<details>
<summary>Release Notes</summary>
<h4><a href="https://github.com/prettier/prettier/releases/tag/1.19.1">1.19.1</a></h4>

<blockquote><p><a href="https://bounce.depfu.com/github.com/prettier/prettier/blob/master/CHANGELOG.md#1191"><g-emoji class="g-emoji" alias="link" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f517.png">🔗</g-emoji> Changelog</a></p></blockquote>
<p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/prettier/feedback">Please let us know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a href="https://github.com/prettier/prettier/compare/e788e8d3d5a45318862af7f719c798573ae4c5c8...95b8e54d1a6eeabebd81db37a4e088ea1de9197d">See the full diff on Github</a>. The new version differs by 8 commits:</p>

<ul>
<li><a href="https://github.com/prettier/prettier/commit/95b8e54d1a6eeabebd81db37a4e088ea1de9197d"><code>Release 1.19.1</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/9b1726d3cde4ef363d3a91bb06195e89b3e29588"><code>Quick-fix for stdin being broken in 1.19.0 (#6894)</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/6cba8ceb9ec5636272c59d76e75ebda22a9c6cbe"><code>Fix `since` version for `vueIndentScriptAndStyle` (#6897)</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/b091fd3b59762fed813e06489967960eb1e5a94a"><code>Remove out-of-date comment</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/58c6b42aa80ea8681c3b8aaaf8f891c9e4f15e51"><code>fix formatting of union type as arrow function return type (#6896)</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/8c3efeb9df251da800cd118ecb4ddf7b33248ff4"><code>Try to fix some code blocks in 1.19.0 blog post</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/4eb3e2650a3cc4be5b13afe55fe01ce790c1634d"><code>Blog post, changelog and docs for 1.19 (#6787)</code></a></li>
<li><a href="https://github.com/prettier/prettier/commit/98d27c7de29891f986aa36af7b1bf0e424619f4e"><code>Bump Prettier dependency to 1.19.0</code></a></li>
</ul>
</details>






---
![Depfu Status](https://depfu.com/badges/0426e53c73caad58f5f0a1adfe2ca1ac/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>




Patch:
diff --git a/documentation/assertions/array-like/to-have-an-item-satisfying.md b/documentation/assertions/array-like/to-have-an-item-satisfying.md
index 969fb1aa..d2e4f901 100644
--- a/documentation/assertions/array-like/to-have-an-item-satisfying.md
+++ b/documentation/assertions/array-like/to-have-an-item-satisfying.md
@@ -51,7 +51,11 @@ In case of a failing expectation you get the following output:
 
 ```js
 expect(
-  [['0', '1'], ['5', '6'], ['7', '8']],
+  [
+    ['0', '1'],
+    ['5', '6'],
+    ['7', '8']
+  ],
   'to have an item satisfying',
   'to have an item satisfying',
   'to be a number'
diff --git a/documentation/assertions/array-like/to-have-items-satisfying.md b/documentation/assertions/array-like/to-have-items-satisfying.md
index 805c3599..3f352200 100644
--- a/documentation/assertions/array-like/to-have-items-satisfying.md
+++ b/documentation/assertions/array-like/to-have-items-satisfying.md
@@ -33,7 +33,11 @@ In case of a failing expectation you get the following output:
 
 ```js
 expect(
-  [[0, 1, 2], [4, '5', '6'], [7, '8', 9]],
+  [
+    [0, 1, 2],
+    [4, '5', '6'],
+    [7, '8', 9]
+  ],
   'to have items satisfying',
   'to have items satisfying',
   'to be a number'
diff --git a/lib/assertions.js b/lib/assertions.js
index 488cb25e..c4bc2099 100644
--- a/lib/assertions.js
+++ b/lib/assertions.js
@@ -1605,7 +1605,10 @@ module.exports = expect => {
                   toSatisfyMatrix[aIndex][bIndex] = err;
                   return false;
                 }
-                result.then(() => {}, () => {});
+                result.then(
+                  () => {},
+                  () => {}
+                );
                 if (result.isPending()) {
                   isAsync = true;
                   return false;
@@ -2247,7 +2250,10 @@ module.exports = expect => {
 
   expect.addAssertion('<function> to be rejected', (expect, subject) => {
     expect.errorMode = 'nested';
-    return expect(expect.promise(() => subject()), 'to be rejected');
+    return expect(
+      expect.promise(() => subject()),
+      'to be rejected'
+    );
   });
 
   expect.addAssertion(
@@ -2310,7 +2316,10 @@ module.exports = expect => {
 
   expect.addAssertion('<function> to be fulfilled', (expect, subject) => {
     expect.errorMode = 'nested';
-    return expect(expect.promise(() => subject()), 'to be fulfilled');
+    return expect(
+      expect.promise(() => subject()),
+      'to be fulfilled'
+    );
   });
 
   expect.addAssertion(
@@ -2396,7 +2405,11 @@ module.exports = expect => {
     '<function> when rejected <assertion>',
     (expect, subject, ...rest) => {
       expect.errorMode = 'nested';
-      return expect(expect.promise(() => subject()), 'when rejected', ...rest);
+      return expect(
+        expect.promise(() => subject()),
+        'when rejected',
+        ...rest
+      );
     }
   );
 
@@ -2442,7 +2455,11 @@ module.exports = expect => {
     '<function> when fulfilled <assertion>',
     (expect, subject, ...rest) => {
       expect.errorMode = 'nested';
-      return expect(expect.promise(() => subject()), 'when fulfilled', ...rest);
+      return expect(
+        expect.promise(() => subject()),
+        'when fulfilled',
+        ...rest
+      );
     }
   );
 
diff --git a/lib/createTopLevelExpect.js b/lib/createTopLevelExpect.js
index 75d54dc6..393a6e8a 100644
--- a/lib/createTopLevelExpect.js
+++ b/lib/createTopLevelExpect.js
@@ -815,7 +815,7 @@ expectPrototype.addType = function(type, childExpect) {
   }
 
   extendedType.inspect = function(obj, depth, output, inspect) {
-    if (arguments.length < 2 || (!output || !output.isMagicPen)) {
+    if (arguments.length < 2 || !output || !output.isMagicPen) {
       return `type: ${type.name}`;
     } else if (childExpect) {
       const childOutput = childExpect.createOutput(output.format);
diff --git a/lib/utils.js b/lib/utils.js
index ef9f9118..cf4ec576 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -363,8 +363,15 @@ const utils = (module.exports = {
   },
 
   getEnv(varName) {
-    if (typeof Deno === 'object' && Deno.permissions().env) {
-      return Deno.env()[varName];
+    if (typeof Deno === 'object') {
+      try {
+        return Deno.env()[varName];
+      } catch (err) {
+        // Probably a permissions error because we don't have permission to read the environment variables
+        // Unfortunately the whole permissions API is async now:
+        // https://github.com/denoland/deno/pull/3200/files
+        // ... so we can't detect whether we do have access
+      }
     } else if (typeof process === 'object' && process.env) {
       return process.env[varName];
     }
diff --git a/package.json b/package.json
index f1c519c8..a6eb5dc2 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
     "diff": "4.0.1",
     "greedy-interval-packer": "1.2.0",
     "leven": "2.1.0",
-    "magicpen": "^6.1.0",
+    "magicpen": "^6.1.1",
     "unexpected-bluebird": "2.9.34-longstack2"
   },
   "devDependencies": {
@@ -63,7 +63,7 @@
     "node-version-check": "^2.2.0",
     "nyc": "^14.0.0",
     "offline-github-changelog": "^1.6.1",
-    "prettier": "~1.18.2",
+    "prettier": "~1.19.1",
     "rollup": "^1.0.1",
     "rollup-plugin-commonjs": "^10.0.0",
     "rollup-plugin-multi-entry": "^2.1.0",


Test patch:
diff --git a/test/assertions/to-have-items-satisfying.spec.js b/test/assertions/to-have-items-satisfying.spec.js
index 5b4fbeeb..c7158946 100644
--- a/test/assertions/to-have-items-satisfying.spec.js
+++ b/test/assertions/to-have-items-satisfying.spec.js
@@ -215,7 +215,11 @@ describe('to have items satisfying assertion', () => {
     expect(
       function() {
         expect(
-          [[0, 1, 2], [4, '5', 6], [7, 8, '9']],
+          [
+            [0, 1, 2],
+            [4, '5', 6],
+            [7, 8, '9']
+          ],
           'to have items satisfying',
           // prettier-ignore
           expect.it(function(arr) {
diff --git a/test/assertions/to-have-values-satisfying.spec.js b/test/assertions/to-have-values-satisfying.spec.js
index 8bc66067..36779c32 100644
--- a/test/assertions/to-have-values-satisfying.spec.js
+++ b/test/assertions/to-have-values-satisfying.spec.js
@@ -33,7 +33,11 @@ describe('to have values satisfying assertion', () => {
   it('only accepts objects and arrays as the target', () => {
     expect(
       function() {
-        expect(42, 'to have values satisfying', expect.it(function(value) {}));
+        expect(
+          42,
+          'to have values satisfying',
+          expect.it(function(value) {})
+        );
       },
       'to throw',
       'expected 42 to have values satisfying expect.it(function (value) {})\n' +
diff --git a/test/assertions/when-passed-as-parameter-to.spec.js b/test/assertions/when-passed-as-parameter-to.spec.js
index 372e0ca3..4a7eb9a3 100644
--- a/test/assertions/when-passed-as-parameter-to.spec.js
+++ b/test/assertions/when-passed-as-parameter-to.spec.js
@@ -36,7 +36,10 @@ describe('when passed as parameters to assertion', () => {
 
   it('should combine with other assertions (showcase)', () => {
     expect(
-      [[1, 2], [3, 4]],
+      [
+        [1, 2],
+        [3, 4]
+      ],
       'to have items satisfying',
       'when passed as parameters to',
       add,
diff --git a/test/types/Promise-type.spec.js b/test/types/Promise-type.spec.js
index de39ee9c..f7384686 100644
--- a/test/types/Promise-type.spec.js
+++ b/test/types/Promise-type.spec.js
@@ -54,7 +54,10 @@ describe('Promise type', () => {
   describe('with a Bluebird promise (that supports synchronous inspection)', () => {
     it('should inspect a pending promise', () => {
       var promise = expect.promise(function(run) {
-        setTimeout(run(function() {}), 0);
+        setTimeout(
+          run(function() {}),
+          0
+        );
       });
       expect(promise, 'to inspect as', 'Promise (pending)');
       return promise;
diff --git a/test/utils.spec.js b/test/utils.spec.js
index ca495dbc..6c1837c7 100644
--- a/test/utils.spec.js
+++ b/test/utils.spec.js
@@ -54,11 +54,19 @@ describe('utils', () => {
 
     describe('#getFunctionName', () => {
       it('should return the name of a named function', () => {
-        expect(utils.getFunctionName(function foo() {}), 'to equal', 'foo');
+        expect(
+          utils.getFunctionName(function foo() {}),
+          'to equal',
+          'foo'
+        );
       });
 
       it('should return the empty string for an anonymous function', () => {
-        expect(utils.getFunctionName(function() {}), 'to equal', '');
+        expect(
+          utils.getFunctionName(function() {}),
+          'to equal',
+          ''
+        );
       });
 
       describe('with Function.prototype.toString mocked out', () => {