Ika Pkhakadze
05/30/2024, 11:00 AMpact-web
project is discontinued, meaning that my only option is to run Angular tests in a node environment using jest-pact
Is there anyone who could make it work with Angular?Matt (pactflow.io / pact-js / pact-go)
jest-pact
, you can just use regular pact (jest pact probably doesn’t add a lot of value over and above vanilla Pact these days)Matt (pactflow.io / pact-js / pact-go)
Ika Pkhakadze
05/30/2024, 11:09 AMjsdom
environment in jest, and it makes a lot of sense. It needs to spin up a local server to setup interactions, and also it should be able to write contracts into the file.
On the other hand i can't make Angular to work with node
environment in jest.Ika Pkhakadze
05/30/2024, 11:10 AMpact-web
)Matt (pactflow.io / pact-js / pact-go)
node
environment. Interesting.Matt (pactflow.io / pact-js / pact-go)
Ika Pkhakadze
05/30/2024, 11:12 AMhttpClient
Ika Pkhakadze
05/30/2024, 11:18 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Ika Pkhakadze
05/30/2024, 11:41 AMIka Pkhakadze
05/30/2024, 12:55 PMReferenceError: XMLHttpRequest is not defined
This happens when I try to use HTTPClient
to make a POST request. The root cause is that I am running Angular code in a Node.js environment, where XMLHttpRequest
does not exist.Matt (pactflow.io / pact-js / pact-go)
(global as any).XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
Ika Pkhakadze
06/04/2024, 9:10 AMnode
environment in jest. turns out running it in jsdom
is sufficient for pact.
Another note: i was trying to use ng-neat
for setting up tests, but it is a bit more tricky to set it up by making sure that the pact server is running before everything else. using angulars default TestBed
seems to be better..Ika Pkhakadze
06/04/2024, 9:20 AMIka Pkhakadze
06/04/2024, 9:22 AMpact-web
which is obsolete.
@Matt (pactflow.io / pact-js / pact-go) it might be good to remove it from the documentation and put it back when it's updated to the latest version..
Anyways, thanks for your support
✌️