Open NickKelly1 opened 3 weeks ago
Thanks for reporting! Now that Node.js has util.getCallSite()
, I think we can rely on that instead of patching Error
to achieve this if that new function is available. Would you like to send a Pull Request to address this? Remember to add unit tests.
Sure thing, I'll create a a PR for it.
I'm not sure how to build or test the project after looking in the README.md and CONTRIBUTING.md. I installed dependencies with npm install
. npm run test
is failing for me due to linting errors and npm run transpile && tap --ts && jest test/jest && npm run test-types
is also failing due to typescript errors. How can I proceed?
NodeJS version 22.11.0 git main 231adff build(deps-dev): bump @yao-pkg/pkg from 5.15.0 to 6.0.0 (#2070)
npm run test
> pino@9.5.0 test
> npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types
> pino@9.5.0 lint
> eslint .
<...>/pino/test/fixtures/ts/to-file-transport.js
1:1 error Strings must use singlequote quotes
1:13 error Extra semicolon semi
3:1 error Expected indentation of 2 spaces but found 4 indent
3:19 error Missing space before function parentheses space-before-function-paren
3:106 error Extra semicolon semi
3:110 error Extra semicolon semi
4:1 error Expected indentation of 2 spaces but found 4 indent
5:1 error Expected indentation of 4 spaces but found 8 indent
5:27 error Missing space before function parentheses space-before-function-paren
5:70 error Extra semicolon semi
5:95 error Extra semicolon semi
6:1 error Expected indentation of 4 spaces but found 8 indent
6:26 error Missing space before function parentheses space-before-function-paren
6:57 error ["throw"] is better written in dot notation dot-notation
6:57 error Strings must use singlequote quotes
6:73 error Extra semicolon semi
# ...
npm run transpile && npx tap --ts && jest test/jest && npm run test-types
> pino@9.5.0 transpile
> node ./test/fixtures/ts/transpile.cjs
<...>/pino/node_modules/execa/lib/error.js:60
error = new Error(message);
^
Error: Command failed with exit code 2: tsc --target es5 --module commonjs to-file-transport.ts
../../../node_modules/@types/node/events.d.ts(144,18): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
at makeError (<...>/pino/node_modules/execa/lib/error.js:60:11)
at handlePromise (<...>/pino/node_modules/execa/index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async transpile (<...>/pino/test/fixtures/ts/transpile.cjs:26:9) {
shortMessage: 'Command failed with exit code 2: tsc --target es5 --module commonjs to-file-transport.ts',
command: 'tsc --target es5 --module commonjs to-file-transport.ts',
escapedCommand: 'tsc --target es5 --module commonjs to-file-transport.ts',
exitCode: 2,
signal: undefined,
signalDescription: undefined,
stdout: '../../../node_modules/@types/node/events.d.ts(144,18): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.',
stderr: '',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Node.js v22.11.0
running:
npm install
npm test
get everything done.
nick@marmot:~/development/tmp/80x/11/12$ git clone git@github.com:pinojs/pino.git
Cloning into 'pino'...
remote: Enumerating objects: 8967, done.
remote: Counting objects: 100% (2410/2410), done.
remote: Compressing objects: 100% (401/401), done.
remote: Total 8967 (delta 2177), reused 2182 (delta 2005), pack-reused 6557 (from 1)
Receiving objects: 100% (8967/8967), 3.01 MiB | 7.23 MiB/s, done.
Resolving deltas: 100% (6242/6242), done.
nick@marmot:~/development/tmp/80x/11/12$ cd pino
nick@marmot:~/development/tmp/80x/11/12/pino$ node -v
v20.18.0
nick@marmot:~/development/tmp/80x/11/12/pino$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
nick@marmot:~/development/tmp/80x/11/12/pino$ git branch -v
* main 231adff build(deps-dev): bump @yao-pkg/pkg from 5.15.0 to 6.0.0 (#2070)
nick@marmot:~/development/tmp/80x/11/12/pino$ npm install
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.4.5: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@6.0.4: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@5.0.15: Glob versions prior to v9 are no longer supported
npm warn deprecated docsify-server-renderer@4.13.1: docsify-server-renderer 4.x and below is no longer supported while we investigate the future of SSR and SSG for Docsify
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
added 1443 packages, and audited 1607 packages in 8s
212 packages are looking for funding
run `npm fund` for details
9 vulnerabilities (7 moderate, 2 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
nick@marmot:~/development/tmp/80x/11/12/pino$ npm test
> pino@9.5.0 test
> npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types
> pino@9.5.0 lint
> eslint .
> pino@9.5.0 transpile
> node ./test/fixtures/ts/transpile.cjs
/home/nick/development/tmp/80x/11/12/pino/node_modules/execa/lib/error.js:60
error = new Error(message);
^
Error: Command failed with exit code 2: tsc --target es5 --module commonjs to-file-transport.ts
../../../node_modules/@types/node/events.d.ts(144,18): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
at makeError (/home/nick/development/tmp/80x/11/12/pino/node_modules/execa/lib/error.js:60:11)
at handlePromise (/home/nick/development/tmp/80x/11/12/pino/node_modules/execa/index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async transpile (/home/nick/development/tmp/80x/11/12/pino/test/fixtures/ts/transpile.cjs:26:9) {
shortMessage: 'Command failed with exit code 2: tsc --target es5 --module commonjs to-file-transport.ts',
command: 'tsc --target es5 --module commonjs to-file-transport.ts',
escapedCommand: 'tsc --target es5 --module commonjs to-file-transport.ts',
exitCode: 2,
signal: undefined,
signalDescription: undefined,
stdout: '../../../node_modules/@types/node/events.d.ts(144,18): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.',
stderr: '',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Node.js v20.18.0
nick@marmot:~/development/tmp/80x/11/12/pino$
Which OS are you testing on? Everything works fine my machine and in CI.
I've pulled the latest main branch and it installs and tests now on node v20.18.0
Which OS are you testing on? Everything works fine my machine and in CI.
Linux 6.8.0-48-generic Ubuntu 22.04.5 LTS x86_64
When the NodeJS process runs with
--frozen-intrinsics
, creating a pino logger throws an error.Due to this line
https://github.com/pinojs/pino/blob/231adffeccd71f26627a43260c09bfb61a98fcaa/lib/caller.js#L9