SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.02k forks source link

SPFx Automation / Unit Test Solutions - which library / framework to use? #9128

Open necik11 opened 1 year ago

necik11 commented 1 year ago

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

πŸ’₯ SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

Additional environment details

Issue description

Hello,

I would like to ask about automatic tests for SPFx - webparts/extensions.

I would like to use the tests for CI/CD and the question is which library or framework to use....

Overall I would summarize:

The first thing google finds is a webinar where Jest and Enzyme are shown.

Unfortunately there is a react version 16... Enzyme-adapter-16 doesn't work for higher versions of react and there is something called "hotfix".

and after a more detailed examination you can look up : Enzyme is dead. Now what?

Either you can find Vitest: Why Vitest Is Better Than Jest

and also one/ maybe best: Cypress is superior to React Testing Library - here's why.

Each has its pros and cons, but where should I start, I don't want to waste time with an enzyme that no longer has (from what I understand) a future.

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.