Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular setup: Missing example Pact with Karma + Jasmine #240

Open
kSzajo opened this issue Mar 21, 2023 · 8 comments
Open

Angular setup: Missing example Pact with Karma + Jasmine #240

kSzajo opened this issue Mar 21, 2023 · 8 comments

Comments

@kSzajo
Copy link
Contributor

kSzajo commented Mar 21, 2023

On https://docs.pact.io/implementation_guides/javascript#examples there is a link pointing to Pact with Karma + Jasmine which does not exist.

@YOU54F
Copy link
Member

YOU54F commented Mar 21, 2023

ahh that is actually an old page, and should be removed, you'll note it doesn't have a side bar as it isn't attached to the main sites nav.

Support was dropped for pact-web and karma as per this comment

pact-foundation/pact-js#626 (comment)

might be worth jumping on pact-slack in the pact-js channel to discuss options

@kSzajo
Copy link
Contributor Author

kSzajo commented Mar 21, 2023

I would like to introduce pact contract testing in angular application. As support for pact-web and karma-pact discontinued, my only option is to add Jest just for sake of using Pact?

@mefellows
Copy link
Member

I would like to introduce pact contract testing in angular application. As support for pact-web and karma-pact discontinued, my only option is to add Jest for just sake of using Pact?

Well, Jest is one option, but essentially yes. Pact needs a server-side to work and Pact JS is currently not split out architecturally to support running in a non-Node process. Doing so is a non-trivial amount of work and we have no plans to do it at this stage.

@kSzajo
Copy link
Contributor Author

kSzajo commented Mar 22, 2023

I would like to introduce pact contract testing in angular application. As support for pact-web and karma-pact discontinued, my only option is to add Jest for just sake of using Pact?

Well, Jest is one option, but essentially yes. Pact needs a server-side to work and Pact JS is currently not split out architecturally to support running in a non-Node process. Doing so is a non-trivial amount of work and we have no plans to do it at this stage.

As angular has its own way of testing using karma and jasmine I think it is worth mentioning somewhere within docs that these are not supported and provide some alternative example solution. It might be hard for a new joiner to set up Pact in angular app as community tutorials around the web include discontinued dependencies. What you think?

@mefellows
Copy link
Member

There is a section here on angular/non-node environments: https://github.com/pact-foundation/pact-js/blob/master/docs/troubleshooting.md#usage-with-angular

Perhaps it's not visible/accessible enough?

@kSzajo
Copy link
Contributor Author

kSzajo commented Mar 22, 2023

I didn't find this page before, I was looking for a straight angular example. Maybe its worth adding a readme file to https://github.com/pact-foundation/pact-js/tree/master/examples/ to indicate that angular projects need to use Jest?

Mentioned starter schematic at https://github.com/pact-foundation/pact-js/blob/master/docs/troubleshooting.md#usage-with-angular isn't maintained and contains discontinued dependencies

@mefellows
Copy link
Member

I'm not sure how much that will aid with discoverability either. Perhaps we need a whole section on use cases within the Pact JS documentation so that it stands out in the navbar?

@kSzajo
Copy link
Contributor Author

kSzajo commented Mar 23, 2023

Agree. I noticed that so far examples are framework agnostic. I finally managed to set up angular using jest but it took me couple hours to understand Pact V3 API and jest config. Example on main page actually isn't compiling https://github.com/pact-foundation/pact-js#usage because Promise needs to be returned
image

Additionally Angular is using Observable instead of Promise which also deters new developers from using Pact in angular as $observable.toPromise() is deprecated

@kSzajo kSzajo closed this as completed Mar 23, 2023
@kSzajo kSzajo reopened this Mar 23, 2023
@kSzajo kSzajo changed the title Missing example Pact with Karma + Jasmine Angular setup: Missing example Pact with Karma + Jasmine Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants