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 am running a Typescript project with ts-jest in place for testing. Running the following code, I get an unhandled promise rejection with the error Response is not defined.
importmakeServiceWorkerEnvfrom'service-worker-mock';importmakeFetchMockfrom'service-worker-mock/fetch';describe('test handler',()=>{beforeEach(()=>{Object.assign(global,makeServiceWorkerEnv(),makeFetchMock());jest.resetModules();});test('return untouched request when there are no redirections',async()=>{// import the moduleconsthandler=require('./handler');// this throws the rejection// create a test requestconststringUrl='http://www.example.com/resource.html';constreq=newRequest(stringUrl);// this is created correctly, the mock is active here// create a redirections arrayconstred: Redirection[]=[];constforwardedReq=handler(req,red);awaitexpect(forwardedReq).resolves.toBe(req);});});
Any idea of what could be the issue?
The text was updated successfully, but these errors were encountered:
Hi,
I am running a Typescript project with
ts-jest
in place for testing. Running the following code, I get an unhandled promise rejection with the errorResponse is not defined
.Any idea of what could be the issue?
The text was updated successfully, but these errors were encountered: