You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into a similar issue to #204 with the new AbortController module introduced in v0.9.0.
My Node.js/Express app still seems fine when I hit API endpoints manually, or testing through Postman. However, when trying to run unit tests with Jest (v26.3.0), it complains throwing a ReferenceError:
FAIL test/base.test.js
● Test suite failed to run
ReferenceError: Request is not defined
19 |
20 | /* SETUP */
> 21 | const Airtable = require('airtable');
| ^
22 |
23 |
24 |
at Object.<anonymous> (node_modules/airtable/lib/abort-controller.js:5:25)
at Object.<anonymous> (node_modules/airtable/lib/base.js:8:23)
at Object.<anonymous> (node_modules/airtable/lib/airtable.js:3:12)
at Object.<anonymous> (lib/base.js:21:18)
at Object.<anonymous> (test/base.test.js:3:14)
This seems to be expected behavior for Jest as they don't polyfill environments, but I'm not sure how to proceed.
Forking the repo and changing the lib/abort-controller.js file to the following:
varfetch=require('node-fetch');// istanbul ignore fileif(typeofwindow==='undefined'){module.exports=require('abort-controller');}else{if('signal'innewfetch.Request('')){module.exports=window.AbortController;}else{varpolyfill=require('abortcontroller-polyfill/dist/cjs-ponyfill');module.exports=polyfill.AbortController;}}
silences the ReferenceError when running the tests, but then throws a TypeError: fetch is not a function., presumably from my poorly-hacked "solution".
Does any one have ideas on how to proceed?
The text was updated successfully, but these errors were encountered:
I'm running into a similar issue to #204 with the new AbortController module introduced in v0.9.0.
My Node.js/Express app still seems fine when I hit API endpoints manually, or testing through Postman. However, when trying to run unit tests with Jest (v26.3.0), it complains throwing a
ReferenceError
:This seems to be expected behavior for Jest as they don't polyfill environments, but I'm not sure how to proceed.
Forking the repo and changing the
lib/abort-controller.js
file to the following:silences the
ReferenceError
when running the tests, but then throws aTypeError: fetch is not a function.
, presumably from my poorly-hacked "solution".Does any one have ideas on how to proceed?
The text was updated successfully, but these errors were encountered: