MCPcopy
hub / github.com/axios/axios / testUnwritableErrorStack

Function testUnwritableErrorStack

tests/unit/axios.test.js:7–21  ·  view source on GitHub ↗
(stackAttributes)

Source from the content-addressed store, hash-verified

5describe('Axios', () => {
6 describe('handle un-writable error stack', () => {
7 const testUnwritableErrorStack = async (stackAttributes) => {
8 const axios = new Axios({});
9 // Mock axios._request to return an Error with an un-writable stack property.
10 axios._request = () => {
11 const mockError = new Error('test-error');
12 Object.defineProperty(mockError, 'stack', stackAttributes);
13 throw mockError;
14 };
15
16 try {
17 await axios.request('test-url', {});
18 } catch (e) {
19 assert.strictEqual(e.message, 'test-error');
20 }
21 };
22
23 it('should support errors with a defined but un-writable stack', async () => {
24 await testUnwritableErrorStack({ value: {}, writable: false });

Callers 1

axios.test.jsFile · 0.85

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected