Skip to content

Commit

Permalink
Merge pull request #77 from UnicodeSnowman/fix-stitcherror-stacktrace…
Browse files Browse the repository at this point in the history
…s-in-node

Fix StitchError stack traces in node
  • Loading branch information
UnicodeSnowman committed Nov 15, 2017
2 parents 832fa3d + b1378f5 commit 760c920
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"node": "6"
},
"useBuiltins": "usage",
}]
}],
],
"plugins": [
"transform-async-to-generator",
"babel-plugin-add-module-exports",
"version-transform"
"version-transform",
["babel-plugin-transform-builtin-extend", { globals: ["Error"] }]
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"babel-loader": "^7.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-preset-env": "^1.6.1",
"conventional-changelog-cli": "^1.3.1",
"eslint": "^3.19.0",
Expand Down
9 changes: 9 additions & 0 deletions test/errors.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StitchError } from '../src/errors';

describe('StitchError', () => {
it('reports a full stack trace', () => {
const err = new StitchError("Oh noes!");
expect(err.toString()).toEqual('StitchError: Oh noes!');
expect(err.stack.length).toBeGreaterThan(err.toString().length);
});
});

0 comments on commit 760c920

Please sign in to comment.