-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from pinojs/feat/source-maps
Add source maps support
- Loading branch information
Showing
9 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ node_js: | |
- '8' | ||
- '10' | ||
- '12' | ||
- '13' | ||
script: | ||
- npm run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
*.log | ||
.nyc_output | ||
module-ts.js | ||
module-ts.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const pino = process.env.NODE_ENV === 'development' ? require('../')(require('pino')()) : require('pino')() | ||
|
||
function add(n: number, m: number) { | ||
return n + m | ||
} | ||
|
||
async function main() { | ||
pino.info(add(2, 3)) | ||
} | ||
|
||
main() | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "examples", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"compile": "tsc -sourcemap module-ts.ts", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@types/node": "^12.7.5", | ||
"typescript": "^3.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test-ts.js | ||
test-ts.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import tap = require('tap') | ||
import pino = require('pino') | ||
import through2 = require('through2') | ||
import pinoCaller = require('../') | ||
|
||
tap.test('pino caller works with sourcemaps (typescript)', function (t) { | ||
t.plan(3) | ||
|
||
const pinoInstance = pinoCaller(pino(through2(function (chunk, enc, callback) { | ||
const res = JSON.parse(chunk.toString('utf8')) | ||
const regex = /Test.<anonymous> \(\/(.)*tests\/test-ts.ts/ | ||
t.ok(res.caller, 'caller property is set') | ||
t.equal(typeof res.caller, 'string', 'caller property is a string') | ||
t.ok(regex.test(res.caller), 'caller property matches the test regex') | ||
}))) | ||
|
||
pinoInstance.info('test') | ||
}) |