xpl / ololog

A better console.log for the log-driven debugging junkies
https://www.npmjs.com/package/ololog
The Unlicense
215 stars 8 forks source link

ololog/reporter: TypeError: (intermediate value).clean.at is not a function #26

Open unlight opened 3 years ago

unlight commented 3 years ago

TypeError: (intermediate value).clean.at is not a function

How to repeat:

git clone https://github.com/unlight/node-package-starter.git
cd node-package-starter
npm i
npm i -D  ololog
# change src/index.spec.ts, change line with 'Hello world' to
# expect(library.hello()).toEqual('Hello world!!!');
node -r ts-node/register/transpile-only node_modules/mocha/bin/_mocha --reporter ololog/reporter  src/**/*.spec.ts

Result:

            const location = new StackTracey ().clean.at (2)
                                                      ^

TypeError: (intermediate value).clean.at is not a function
    at Function.ololog.impl.render (D:\Dev\node-package-starter\node_modules\ololog\reporter.js:62:55)
    at Function.modifiedFunctions.<computed> (D:\Dev\node-package-starter\node_modules\pipez\pipez.js:48:45)
    at Function.modifiedFunctions.<computed> (D:\Dev\node-package-starter\node_modules\pipez\pipez.js:48:45)
    at Function.modifiedFunctions.<computed> (D:\Dev\node-package-starter\node_modules\pipez\pipez.js:48:45)
    at D:\Dev\node-package-starter\node_modules\pipez\pipez.js:23:73
    at Array.reduce (<anonymous>)
    at Function.Object.assign.configure (D:\Dev\node-package-starter\node_modules\pipez\pipez.js:23:39)
    at process.<anonymous> (D:\Dev\node-package-starter\node_modules\ololog\reporter.js:10:48)
    at process.emit (events.js:327:22)
    at process.EventEmitter.emit (domain.js:467:12)
    at process.emit (D:\Dev\node-package-starter\node_modules\source-map-support\source-map-support.js:495:21)
    at process._fatalException (internal/process/execution.js:163:25)

Expected:

Formatted exception https://github.com/xpl/ololog#using-with-mocha

Env:

EnterTheNameHere commented 1 year ago

Encountered this one too.

Seems changing the line https://github.com/xpl/ololog/blob/6e48fc0b7624abc13e6fa667219458f2bcad4170/reporter.js#L62 to

const location = new StackTracey ().clean ().at (2)

might be a solution, since clear is a method.