Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino

Package Overview
Dependencies
Maintainers
4
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino - npm Package Compare versions

Comparing version 7.6.0 to 7.6.1

test/fixtures/eval/index.js

14

lib/caller.js
'use strict'
const fs = require('fs')
function noOpPrepareStackTrace (_, stack) {

@@ -7,2 +9,6 @@ return stack

function isOutsideNodeModules (input) {
return typeof input === 'string' && fs.existsSync(input) && input.indexOf('node_modules') === -1
}
module.exports = function getCaller () {

@@ -18,9 +24,13 @@ const originalPrepare = Error.prepareStackTrace

for (const entry of stack.slice(2)) {
const entries = stack.slice(2)
for (const entry of entries) {
const file = entry ? entry.getFileName() : undefined
if (file && file.indexOf('node_modules') === -1) {
if (isOutsideNodeModules(file)) {
return file
}
}
return entries[0] ? entries[0].getFileName() : undefined
}

2

package.json
{
"name": "pino",
"version": "7.6.0",
"version": "7.6.1",
"description": "super fast, all natural json logger",

@@ -5,0 +5,0 @@ "main": "pino.js",

@@ -10,4 +10,4 @@ 'use strict'

test('app using a custom transport', async function (t) {
const evalApp = join(__dirname, '../', '/fixtures/eval')
test('when using a custom transport outside node_modules, the first file outside node_modules should be used', async function (t) {
const evalApp = join(__dirname, '../', '/fixtures/eval/index.js')
const child = execa(process.argv[0], [evalApp])

@@ -25,1 +25,31 @@

})
test('when using a custom transport where some files in stacktrace are in the node_modules, the first file outside node_modules should be used', async function (t) {
const evalApp = join(__dirname, '../', '/fixtures/eval/node_modules/2-files.js')
const child = execa(process.argv[0], [evalApp])
let actual = ''
child.stdout.pipe(writer((s, enc, cb) => {
actual += s
cb()
}))
await once(child, 'close')
t.match(actual, /done!/)
})
test('when using a custom transport where all files in stacktrace are in the node_modules, the first file inside node_modules should be used', async function (t) {
const evalApp = join(__dirname, '../', '/fixtures/eval/node_modules/14-files.js')
const child = execa(process.argv[0], [evalApp])
let actual = ''
child.stdout.pipe(writer((s, enc, cb) => {
actual += s
cb()
}))
await once(child, 'close')
t.match(actual, /done!/)
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc