diff options
Diffstat (limited to 'test/fetch/client-error-stack-trace.js')
-rw-r--r-- | test/fetch/client-error-stack-trace.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/fetch/client-error-stack-trace.js b/test/fetch/client-error-stack-trace.js new file mode 100644 index 0000000..7d94aa8 --- /dev/null +++ b/test/fetch/client-error-stack-trace.js @@ -0,0 +1,21 @@ +'use strict' + +const { test } = require('tap') +const { fetch } = require('../..') +const { fetch: fetchIndex } = require('../../index-fetch') + +test('FETCH: request errors and prints trimmed stack trace', async (t) => { + try { + await fetch('http://a.com') + } catch (error) { + t.match(error.stack, `at Test.<anonymous> (${__filename}`) + } +}) + +test('FETCH-index: request errors and prints trimmed stack trace', async (t) => { + try { + await fetchIndex('http://a.com') + } catch (error) { + t.match(error.stack, `at Test.<anonymous> (${__filename}`) + } +}) |