File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33## [ 1.0.2]
44
55### Fixes
6+ - [ Issue #6 ] Stack traces should be filtered by .ts extension
67- Typescript Template v2
78
89## [ 1.0.1]
Original file line number Diff line number Diff line change 33 "spec_files" : [ " **/*[sS]pec.js" ],
44 "helpers" : [ " helpers/**/*.js" ],
55 "stopSpecOnExpectationFailure" : false ,
6- "random" : true
6+ "random" : false
77}
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ export interface ErrorHandlerOptions {
2626 // Ignore node internals? (justMyCode must be true)
2727 justMyCodeIncludeInternals : boolean ,
2828
29+ // Ignore javascript & compiled files?
30+ includeJsFiles : boolean ,
31+
2932 // Error handler
3033 handler ?: HandlerFunction ,
3134}
@@ -38,6 +41,7 @@ export const defaultOptions: ErrorHandlerOptions = {
3841 justMyCode : true ,
3942 justMyCodeIncludeNodeModules : false ,
4043 justMyCodeIncludeInternals : false ,
44+ includeJsFiles : false ,
4145
4246 // eslint-disable-next-line no-console
4347 handler : console . error
@@ -72,6 +76,10 @@ export function setupErrorHandling(options: Partial<ErrorHandlerOptions>) {
7276 . filter ( line => {
7377 return (
7478 line &&
79+ (
80+ options . includeJsFiles ||
81+ ! line . includes ( '.js' )
82+ ) &&
7583 (
7684 options . justMyCodeIncludeNodeModules ||
7785 ! line . includes ( 'node_modules' )
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import { getStackTrace } from '../util/get-stack-trace';
66describe ( 'index' , ( ) => {
77 it ( 'sets stack trace to "Just My Code"' , ( ) => {
88 setupErrorHandling ( {
9- justMyCode : true
9+ justMyCode : true ,
10+ includeJsFiles : true ,
1011 } ) ;
1112
1213 const trace = getStackTrace ( ) ;
@@ -15,4 +16,14 @@ describe('index', () => {
1516 expect ( trace ) . not . toContain ( 'node_modules' ) ;
1617 expect ( trace ) . not . toContain ( 'internal/' ) ;
1718 } ) ;
19+
20+ it ( 'allows filtering of .js extension' , ( ) => {
21+ setupErrorHandling ( {
22+ justMyCode : true
23+ } ) ;
24+
25+ const trace = getStackTrace ( ) ;
26+
27+ expect ( trace ) . not . toContain ( '.js' ) ;
28+ } ) ;
1829} ) ;
You can’t perform that action at this time.
0 commit comments