Repository: pinojs/pino
Pull request #1360 (2022-03-07 15:07:41)

build(deps-dev): bump tap from 15.2.3 to 16.0.0
Bumps [tap](https://github.com/tapjs/node-tap) from 15.2.3 to 16.0.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/tapjs/node-tap/commit/8f2baa7eb5e1f4cd0fcf8b60da4fb4e41ea680f1"><code>8f2baa7</code></a> 16.0.0</li>
<li><a href="https://github.com/tapjs/node-tap/commit/65e599e8de3731ed7e4152a4ef8afde1afa27242"><code>65e599e</code></a> drop support for node v10</li>
<li><a href="https://github.com/tapjs/node-tap/commit/84fc6dfcd8c1f9077dd0f25f316fb214a3a6519c"><code>84fc6df</code></a> docs: changelog for v16</li>
<li><a href="https://github.com/tapjs/node-tap/commit/e6acf7b25ea02fea17759259f5c938e414a1499b"><code>e6acf7b</code></a> update coveralls documentation to say to install it</li>
<li><a href="https://github.com/tapjs/node-tap/commit/3c7b3ef6c8792558666676c0b8db5e757ba00ec8"><code>3c7b3ef</code></a> document coveralls removal in the cli help output</li>
<li><a href="https://github.com/tapjs/node-tap/commit/43bf1df7d83287ac419c9b1ad7e9c033fe3aded5"><code>43bf1df</code></a> undocument synonyms</li>
<li><a href="https://github.com/tapjs/node-tap/commit/1ff75a4e5cf2e123bcec87391f2cf316e32f13b0"><code>1ff75a4</code></a> make coveralls an optional peer dep</li>
<li><a href="https://github.com/tapjs/node-tap/commit/3f1ae47bc0050cfd97b0a5ac07054448ada5b69d"><code>3f1ae47</code></a> Add eslint for linting</li>
<li><a href="https://github.com/tapjs/node-tap/commit/162c1a8a92809591fce079ba9f9e1d854649aaa2"><code>162c1a8</code></a> Support Typescript for --before and --after</li>
<li><a href="https://github.com/tapjs/node-tap/commit/28d2d031eec1b3db537b236a879efe32109c3ee3"><code>28d2d03</code></a> Fix script on using node-tap with codecov</li>
<li>Additional commits viewable in <a href="https://github.com/tapjs/node-tap/compare/v15.2.3...v16.0.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tap&package-manager=npm_and_yarn&previous-version=15.2.3&new-version=16.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/docs/api.md b/docs/api.md
index 1557094..0c27d08 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -293,6 +293,8 @@ Changes the shape of the log level. The default shape is `{ level: number }`.
 The function takes two arguments, the label of the level (e.g. `'info'`)
 and the numeric value (e.g. `30`).
 
+ps: The log level cannot be customized when using multiple transports
+
 ```js
 const formatters = {
   level (label, number) {
diff --git a/lib/tools.js b/lib/tools.js
index 97c5f21..91df051 100644
--- a/lib/tools.js
+++ b/lib/tools.js
@@ -409,6 +409,9 @@ function createArgsNormalizer (defaultOptions) {
       if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
         throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)')
       }
+      if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') {
+        throw Error('option.transport.targets do not allow custom level formatters')
+      }
       stream = transport({ caller, ...opts.transport })
     }
     opts = Object.assign({}, defaultOptions, opts)
diff --git a/package.json b/package.json
index dd0e0a5..781c677 100644
--- a/package.json
+++ b/package.json
@@ -93,7 +93,7 @@
     "split2": "^4.0.0",
     "steed": "^1.1.3",
     "strip-ansi": "^6.0.0",
-    "tap": "^15.0.1",
+    "tap": "^16.0.0",
     "tape": "^5.0.0",
     "through2": "^4.0.0",
     "ts-node": "^10.3.0",


Test patch:
diff --git a/test/formatters.test.js b/test/formatters.test.js
index 354a880..75d05cd 100644
--- a/test/formatters.test.js
+++ b/test/formatters.test.js
@@ -335,3 +335,30 @@ test('formatter with transport', async ({ match, equal }) => {
     nested: { object: true }
   })
 })
+
+test('throws when custom level formatter is used with transport.targets', async ({ throws }) => {
+  const destination = join(
+    os.tmpdir(),
+    '_' + Math.random().toString(36).substr(2, 9)
+  )
+
+  throws(() => {
+    pino({
+      formatters: {
+        level (label) {
+          return label
+        }
+      },
+      transport: {
+        targets: [
+          {
+            target: 'pino/file',
+            options: { destination }
+          }
+        ]
+      }
+    }
+    )
+  },
+  Error('option.transport.targets do not allow custom level formatters'))
+})