Bug: Incorrect Line Number
Describe the bug The line number appears to be incorrect. I have a demo of my code below where I created a NEW Typescript project using npx tsc --init. This may just be with using ts-jest with typescript as if I compile my code and run it, then the line number works as expected. not sure if functionality though was only intended for when code was compiled which if so, then I guess this should be ignored. Also, if I were to use a little bit more code then what I have below, the number of lines off grows quite quickly to where I'll get a line 235 instead of line 26.
To Reproduce Steps to reproduce the behavior:
- Create a new project using npx tsc --init
- Replicate my index.ts and index.test.ts files.
- Install Jest.
- Run npx jest and check console.
Expected behavior Logs with the correct line number.
Screenshots

Additional context index.ts
import { Logger} from 'tslog';
export const log: Logger = new Logger({
name: 'monopoly_deal_logger',
minLevel: 'info',
});
log.info('line number 8');
index.test.ts
import { log } from '../src/index';
test('logger', () => {
log.info('this is on line 5');
});
Node.js Version v18.7.0
OS incl. Version Windows 11 - wsl2 w/Ubuntu
It would be interesting to know, how you start the TypeScript version. Can you pls provide that command too. Thx.
There is a new, completely rewritten version (4.0) with native source maps support. Give it a go and let me know if that solves your problem:
-
npm i tslog@next -
and run it with
node --enable-source-mapsor for TypeScriptnode --enable-source-maps --experimental-specifier-resolution=node --no-warnings --loader ts-node/esm
V4 is released now, so I'm going to close this issue. Feel free to open a new one if V4 didn't solve it for you.
Here are the docs: tslog.js.org