@grimen/mybad
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "@grimen/mybad", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "My friendly error base class - for Node/JavaScript.", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"validate": "npx eslint \"**/*.js\"", | ||
"release": "npx np --no-publish", | ||
"release": "npx np", | ||
"coverage": "npx codecov" | ||
@@ -37,0 +37,0 @@ }, |
@@ -415,2 +415,10 @@ | ||
if (stackframeData?.length === 4) { | ||
stackframeData = [ | ||
...stackframeData.slice(0, 2), | ||
null, | ||
...stackframeData.slice(2, 4), | ||
] | ||
} | ||
let [ | ||
@@ -472,7 +480,7 @@ // eslint-disable-next-line | ||
}) | ||
// .filter((stackobject) => { | ||
// return !!stackobject.file | ||
// }) | ||
.filter((stackobject) => { | ||
return !!stackobject.file | ||
}) | ||
.filter((stackobject) => { | ||
const isInternalStackFile = stackobject.file.includes(__filename) | ||
const isInternalStackFile = stackobject.file?.includes(__filename) | ||
const isInternalStackFunction = Object.getOwnPropertyNames(error).includes(stackobject.function) | ||
@@ -479,0 +487,0 @@ const isInternalStackObject = isInternalStackFile && isInternalStackFunction |
@@ -292,2 +292,27 @@ /* global describe test expect */ | ||
expect(error.stackobjects[0].source).toEqual(undefined) | ||
error = new mybad.Error(error) | ||
error.stack = ` | ||
Error: x | ||
at REPL1:1:5 | ||
at Script.runInThisContext (vm.js:133:18) | ||
at REPLServer.defaultEval (repl.js:484:29) | ||
at bound (domain.js:413:15) | ||
at REPLServer.runBound [as eval] (domain.js:424:12) | ||
at REPLServer.onLine (repl.js:817:10) | ||
at REPLServer.emit (events.js:327:22) | ||
at REPLServer.EventEmitter.emit (domain.js:467:12) | ||
at REPLServer.Interface._onLine (readline.js:337:10) | ||
at REPLServer.Interface._line (readline.js:666:8) | ||
`.replace(/^\s{16}/gmi, '') | ||
expect(error.stackobjects).toBeType('array') | ||
expect(error.stackobjects.length).toBeGreaterThan(0) | ||
expect(error.stackobjects[0]).toBeType('object') | ||
expect(error.stackobjects[0].column).toEqual(5) | ||
expect(error.stackobjects[0].file).toEqual(null) | ||
expect(error.stackobjects[0].function).toEqual('REPL1') | ||
expect(error.stackobjects[0].line).toEqual(1) | ||
expect(error.stackobjects[0].source).toEqual(undefined) | ||
}) | ||
@@ -322,3 +347,3 @@ | ||
expect(error.data.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(error.data.stack[0].line).toEqual(295) | ||
expect(error.data.stack[0].line).toEqual(320) | ||
expect(error.data.stack[0].source).toEqual(undefined) | ||
@@ -340,3 +365,3 @@ | ||
expect(error.data.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(error.data.stack[0].line).toEqual(295) | ||
expect(error.data.stack[0].line).toEqual(320) | ||
expect(error.data.stack[0].source).toEqual(undefined) | ||
@@ -371,3 +396,3 @@ }) | ||
expect(data.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(data.stack[0].line).toEqual(343) | ||
expect(data.stack[0].line).toEqual(368) | ||
expect(data.stack[0].source).toEqual(undefined) | ||
@@ -396,3 +421,3 @@ | ||
expect(data.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(data.stack[0].line).toEqual(343) | ||
expect(data.stack[0].line).toEqual(368) | ||
expect(data.stack[0].source).toEqual(undefined) | ||
@@ -503,3 +528,3 @@ }) | ||
expect(errorObject.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(errorObject.stack[0].line).toEqual(472) | ||
expect(errorObject.stack[0].line).toEqual(497) | ||
expect(errorObject.stack[0].source).toEqual(undefined) | ||
@@ -535,3 +560,3 @@ | ||
expect(errorObject.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(errorObject.stack[0].line).toEqual(503) | ||
expect(errorObject.stack[0].line).toEqual(528) | ||
expect(errorObject.stack[0].source).toEqual(undefined) | ||
@@ -564,3 +589,3 @@ | ||
expect(errorObject.stack[0].function).toEqual(expect.stringMatching(/^Object\.(?:test|<anonymous>|mybad\.Error)$/)) | ||
expect(errorObject.stack[0].line).toEqual(532) | ||
expect(errorObject.stack[0].line).toEqual(557) | ||
expect(errorObject.stack[0].source).toEqual(undefined) | ||
@@ -567,0 +592,0 @@ }) |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
48223
914
0