@cucumber/cucumber 12.8.2 → 12.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TestStepResult } from '@cucumber/messages';
|
|
2
|
-
export declare function formatError(error: Error, filterStackTraces: boolean): Pick<TestStepResult, 'message' | 'exception'>;
|
|
2
|
+
export declare function formatError(error: Error | string, filterStackTraces: boolean): Pick<TestStepResult, 'message' | 'exception'>;
|
|
@@ -8,7 +8,18 @@ const assertion_error_formatter_1 = require("assertion-error-formatter");
|
|
|
8
8
|
const error_stack_parser_1 = __importDefault(require("error-stack-parser"));
|
|
9
9
|
const filter_stack_trace_1 = require("../filter_stack_trace");
|
|
10
10
|
function formatError(error, filterStackTraces) {
|
|
11
|
-
|
|
11
|
+
if (typeof error === 'string') {
|
|
12
|
+
const stackTrace = `Error: ${error}`;
|
|
13
|
+
return {
|
|
14
|
+
message: stackTrace,
|
|
15
|
+
exception: {
|
|
16
|
+
type: 'Error',
|
|
17
|
+
message: error,
|
|
18
|
+
stackTrace,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
let processedStackTrace = error.stack;
|
|
12
23
|
try {
|
|
13
24
|
const parsedStack = error_stack_parser_1.default.parse(error);
|
|
14
25
|
const filteredStack = filterStackTraces
|
|
@@ -19,19 +30,21 @@ function formatError(error, filterStackTraces) {
|
|
|
19
30
|
catch {
|
|
20
31
|
// if we weren't able to parse and process, we'll settle for the original
|
|
21
32
|
}
|
|
22
|
-
const
|
|
33
|
+
const stackTrace = (0, assertion_error_formatter_1.format)(error, {
|
|
23
34
|
colorFns: {
|
|
24
35
|
errorStack: (stack) => {
|
|
25
36
|
return processedStackTrace ? `\n${processedStackTrace}` : stack;
|
|
26
37
|
},
|
|
27
38
|
},
|
|
28
39
|
});
|
|
40
|
+
const type = error.constructor.name;
|
|
41
|
+
const message = typeof error === 'string' ? error : error.message;
|
|
29
42
|
return {
|
|
30
|
-
message,
|
|
43
|
+
message: stackTrace,
|
|
31
44
|
exception: {
|
|
32
|
-
type
|
|
33
|
-
message
|
|
34
|
-
stackTrace
|
|
45
|
+
type,
|
|
46
|
+
message,
|
|
47
|
+
stackTrace,
|
|
35
48
|
},
|
|
36
49
|
};
|
|
37
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;AAKA,
|
|
1
|
+
{"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;AAKA,kCA0CC;AA9CD,yEAAkD;AAClD,4EAAiD;AACjD,8DAAwD;AAExD,SAAgB,WAAW,CACzB,KAAqB,EACrB,iBAA0B;IAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,UAAU,KAAK,EAAE,CAAA;QACpC,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,KAAK;gBACd,UAAU;aACX;SACF,CAAA;IACH,CAAC;IACD,IAAI,mBAAmB,GAAW,KAAK,CAAC,KAAK,CAAA;IAC7C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,4BAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,iBAAiB;YACrC,CAAC,CAAC,IAAA,qCAAgB,EAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,WAAW,CAAA;QACf,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,MAAM,UAAU,GAAG,IAAA,kCAAM,EAAC,KAAK,EAAE;QAC/B,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC5B,OAAO,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACjE,CAAC;SACF;KACF,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;IACjE,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE;YACT,IAAI;YACJ,OAAO;YACP,UAAU;SACX;KACF,CAAA;AACH,CAAC","sourcesContent":["import { TestStepResult } from '@cucumber/messages'\nimport { format } from 'assertion-error-formatter'\nimport errorStackParser from 'error-stack-parser'\nimport { filterStackTrace } from '../filter_stack_trace'\n\nexport function formatError(\n error: Error | string,\n filterStackTraces: boolean\n): Pick<TestStepResult, 'message' | 'exception'> {\n if (typeof error === 'string') {\n const stackTrace = `Error: ${error}`\n return {\n message: stackTrace,\n exception: {\n type: 'Error',\n message: error,\n stackTrace,\n },\n }\n }\n let processedStackTrace: string = error.stack\n try {\n const parsedStack = errorStackParser.parse(error)\n const filteredStack = filterStackTraces\n ? filterStackTrace(parsedStack)\n : parsedStack\n processedStackTrace = filteredStack.map((f) => f.source).join('\\n')\n } catch {\n // if we weren't able to parse and process, we'll settle for the original\n }\n const stackTrace = format(error, {\n colorFns: {\n errorStack: (stack: string) => {\n return processedStackTrace ? `\\n${processedStackTrace}` : stack\n },\n },\n })\n const type = error.constructor.name\n const message = typeof error === 'string' ? error : error.message\n return {\n message: stackTrace,\n exception: {\n type,\n message,\n stackTrace,\n },\n }\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "12.8.
|
|
1
|
+
export declare const version = "12.8.3";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.8.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.8.3'\n"]}
|
package/package.json
CHANGED